:root {
  --bg: #f5f5f7;
  --card: #ffffff;
  --ink: #1d1d1f;
  --muted: #6e6e73;
  --line: #e8e8ed;
  --blue: #0071e3;
  --blue-soft: #e8f2ff;
  --green: #22a06b;
  --orange: #f28b36;
  --red: #d94f4f;
  --purple: #7657d6;
  --gold: #a97808;
  --radius: 22px;
  --radius-sm: 14px;
  --radius-xs: 11px;
  --shadow: 0 1px 2px rgba(0,0,0,.03), 0 12px 34px rgba(0,0,0,.055);
  --shadow-hover: 0 1px 2px rgba(0,0,0,.04), 0 20px 48px rgba(0,0,0,.09);
  --shadow-sm: 0 1px 3px rgba(0,0,0,.04);
  --transition-fast: .15s cubic-bezier(.4,0,.2,1);
  --transition-base: .25s cubic-bezier(.4,0,.2,1);
  --transition-slow: .45s cubic-bezier(.4,0,.2,1);
}

/* ─── V4 family wealth dashboard ─── */
.dashboard-intro {
  display: flex; align-items: end; justify-content: space-between; gap: 24px;
  margin: 6px 0 24px;
}
.dashboard-intro h1 { font-size: clamp(30px, 4vw, 46px); }
.wealth-hero {
  position: relative; overflow: hidden; padding: clamp(26px, 5vw, 52px);
  color: #fff; border-radius: 30px;
  background:
    radial-gradient(circle at 86% 18%, rgba(93,170,255,.32), transparent 30%),
    radial-gradient(circle at 72% 100%, rgba(63,208,163,.16), transparent 34%),
    linear-gradient(135deg, #101b2f 0%, #162943 55%, #132337 100%);
  box-shadow: 0 24px 60px rgba(24,43,67,.18);
}
.wealth-hero::after {
  content: ""; position: absolute; right: -70px; top: -100px;
  width: 290px; height: 290px; border: 1px solid rgba(255,255,255,.12);
  border-radius: 50%; box-shadow: 0 0 0 34px rgba(255,255,255,.025), 0 0 0 70px rgba(255,255,255,.018);
}
.wealth-main { position: relative; z-index: 1; max-width: 700px; }
.wealth-main > p { margin: 0 0 6px; color: rgba(255,255,255,.65); }
.wealth-main > strong {
  display: block; margin: 4px 0 24px; font-size: clamp(38px, 7vw, 66px);
  line-height: 1; letter-spacing: -.055em; font-variant-numeric: tabular-nums;
}
.goal-line, .goal-meta { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.goal-line { margin-bottom: 9px; color: rgba(255,255,255,.82); }
.wealth-hero progress {
  width: 100%; height: 10px; overflow: hidden; border: 0; border-radius: 999px;
  background: rgba(255,255,255,.15);
}
.wealth-hero progress::-webkit-progress-bar { background: rgba(255,255,255,.15); border-radius: 999px; }
.wealth-hero progress::-webkit-progress-value { border-radius: 999px; background: linear-gradient(90deg, #66b5ff, #6fe0bd); }
.wealth-hero progress::-moz-progress-bar { border-radius: 999px; background: linear-gradient(90deg, #66b5ff, #6fe0bd); }
.goal-meta { margin-top: 10px; justify-content: flex-start; color: rgba(255,255,255,.55); font-size: 12px; }
.goal-editor { position: absolute; z-index: 2; right: 28px; top: 24px; }
.goal-editor > summary {
  list-style: none; padding: 8px 13px; border: 1px solid rgba(255,255,255,.2);
  border-radius: 999px; color: rgba(255,255,255,.78); cursor: pointer; font-size: 12px;
  background: rgba(255,255,255,.08); backdrop-filter: blur(10px);
}
.goal-editor[open] {
  padding: 14px; width: min(340px, calc(100vw - 60px)); border-radius: 18px;
  background: #fff; box-shadow: var(--shadow-hover);
}
.goal-editor[open] > summary { color: var(--ink); border-color: var(--line); margin-bottom: 10px; }
.hero-note { margin: 0; }

.asset-card-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin: 16px 0 46px;
}
.asset-kpi {
  position: relative; min-width: 0; padding: 20px; overflow: hidden;
  border: 1px solid rgba(0,0,0,.045); border-radius: 20px; background: #fff;
  box-shadow: 0 8px 24px rgba(22,39,59,.05);
  transition: transform .22s ease, box-shadow .22s ease;
}
.asset-kpi:hover { transform: translateY(-3px); box-shadow: 0 16px 32px rgba(22,39,59,.1); }
.asset-kpi small, .asset-kpi strong, .asset-kpi em { display: block; }
.asset-kpi small { margin: 10px 0 4px; color: var(--muted); }
.asset-kpi strong { font-size: clamp(20px, 2.2vw, 28px); letter-spacing: -.035em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.asset-kpi em { margin-top: 9px; color: #999; font-size: 11px; font-style: normal; }
.asset-glyph { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 12px; font-weight: 700; }
.asset-kpi.cash .asset-glyph { color: #0879cf; background: #e7f4ff; }
.asset-kpi.stock .asset-glyph { color: #177a56; background: #e5f7ef; }
.asset-kpi.fund .asset-glyph { color: #7051c9; background: #f0ebff; }
.asset-kpi.gold .asset-glyph { color: #9b720d; background: #fff5d5; }

.section-heading, .panel-head {
  display: flex; align-items: end; justify-content: space-between; gap: 18px;
}
.section-heading { margin: 0 0 16px; }
.section-heading a, .panel-head a, .asset-heading > a { color: var(--blue); font-size: 13px; }
.monthly-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 16px; }
.flow-card, .fixed-card, .budget-panel, .allocation-card {
  border: 1px solid rgba(0,0,0,.045); border-radius: 24px; background: #fff; box-shadow: var(--shadow);
}
.flow-card, .fixed-card { padding: 24px; }
.flow-card > small, .fixed-card small { color: var(--muted); }
.flow-total { display: block; margin: 6px 0 18px; font-size: 34px; letter-spacing: -.04em; }
.flow-summary { display: grid; grid-template-columns: 1fr 1fr; padding: 14px 0; border-block: 1px solid var(--line); }
.flow-summary span { display: flex; flex-direction: column; color: var(--muted); font-size: 12px; }
.flow-summary b { margin-top: 2px; color: var(--ink); font-size: 16px; }
.member-spend-list { display: grid; gap: 11px; margin-top: 18px; }
.member-spend-list > div { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 9px; }
.member-spend-list b { font-variant-numeric: tabular-nums; }
.fixed-card > details > summary { display: flex; align-items: center; justify-content: space-between; cursor: pointer; list-style: none; }
.fixed-card > details > summary div small, .fixed-card > details > summary div strong { display: block; }
.fixed-card > details > summary strong { margin-top: 5px; font-size: 28px; }
.fixed-card > details > summary > span { color: var(--blue); font-size: 12px; }

.budget-panel { margin: 16px 0; padding: 24px; }
.budget-board { display: grid; gap: 15px; margin-top: 22px; }
.budget-line { display: grid; grid-template-columns: minmax(190px, .8fr) 1fr 48px; align-items: center; gap: 18px; }
.budget-line > div { display: grid; grid-template-columns: auto auto 1fr; align-items: center; justify-content: start; gap: 7px; }
.budget-line small { grid-column: 2 / 4; color: var(--muted); }
.budget-line em { padding: 2px 7px; color: #9c6517; border-radius: 999px; background: #fff1d5; font-size: 10px; font-style: normal; }
.budget-line progress { width: 100%; height: 8px; border: 0; border-radius: 99px; overflow: hidden; }
.budget-line progress::-webkit-progress-bar { background: #edf0f4; }
.budget-line progress::-webkit-progress-value { background: linear-gradient(90deg, #528eff, #62c9a7); border-radius: 99px; }
.budget-line > strong { text-align: right; font-size: 13px; }

.allocation-card { display: grid; grid-template-columns: .85fr 1.15fr; gap: 34px; padding: clamp(24px, 4vw, 38px); margin: 16px 0 42px; }
.allocation-copy > p:not(.overline) { max-width: 430px; color: var(--muted); }
.allocation-total { display: block; margin-top: 26px; color: var(--muted); font-size: 12px; }
.allocation-total div { display: flex; align-items: baseline; gap: 7px; margin-top: 4px; }
.allocation-total span { font-size: 24px; font-weight: 650; }
.allocation-total input { width: 100%; border: 0; outline: 0; font-size: 34px; font-weight: 700; letter-spacing: -.04em; background: transparent; }
.allocation-status { display: flex; justify-content: space-between; margin: 20px 0 8px; color: var(--muted); font-size: 12px; }
.allocation-status strong.invalid { color: var(--red); }
.allocation-stack { display: flex; height: 9px; overflow: hidden; border-radius: 99px; background: #eee; }
.allocation-stack i:nth-child(1) { background: #4a8ff5; }
.allocation-stack i:nth-child(2) { background: #3fb384; }
.allocation-stack i:nth-child(3) { background: #7a61d1; }
.allocation-stack i:nth-child(4) { background: #ee9a45; }
.allocation-controls { display: grid; gap: 17px; }
.allocation-row { display: grid; grid-template-columns: 1fr 1.2fr 76px; align-items: center; gap: 14px; }
.allocation-row > div { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 8px; }
.allocation-row > div strong { grid-column: 2; color: var(--muted); font-size: 12px; font-weight: 500; }
.tone-dot { width: 9px; height: 9px; border-radius: 50%; }
.tone-dot.blue { background: #4a8ff5; }.tone-dot.green { background: #3fb384; }.tone-dot.purple { background: #7a61d1; }.tone-dot.orange { background: #ee9a45; }
.allocation-row > label { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 10px; padding: 5px 8px; }
.allocation-row > label input { width: 100%; border: 0; outline: 0; }
input[type="range"] { accent-color: #477eeb; }
.analysis-grid.refined { margin-bottom: 34px; }
.chart-head a { color: var(--blue); font-size: 12px; }

.floating-add {
  position: fixed; z-index: 18; right: max(26px, calc((100vw - 1180px) / 2)); bottom: 28px;
  display: flex; align-items: center; gap: 8px; min-width: 58px; height: 58px; padding: 0 18px;
  color: #fff; border-radius: 999px; background: #111b2b;
  box-shadow: 0 12px 35px rgba(13,28,48,.3); transition: transform .2s ease, box-shadow .2s ease;
}
.floating-add:hover { transform: translateY(-3px) scale(1.02); box-shadow: 0 18px 40px rgba(13,28,48,.35); }
.floating-add span { font-size: 25px; font-weight: 300; }.floating-add b { font-size: 13px; }

.settings-heading { display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.settings-shortcuts { display: grid; gap: 9px; min-width: 285px; }
.settings-shortcut, .shortcut-inline {
  display: flex; align-items: center; gap: 12px; padding: 15px 17px; border: 1px solid var(--line);
  border-radius: 17px; background: #fff; box-shadow: var(--shadow-sm);
}
.settings-shortcut > span, .shortcut-inline > span { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; color: #fff; background: linear-gradient(145deg,#5b7cff,#8757d4); }
.settings-shortcut small, .shortcut-inline small { display: block; color: var(--muted); }.settings-shortcut em, .shortcut-inline em { color: var(--muted); font-style: normal; }
.birthday-rule { padding: 16px; border-radius: 16px; background: #f7f7f9; }
.switch-line { display: flex !important; align-items: center; gap: 8px; }
.switch-line input { width: auto !important; }
.percent-input { display: flex; align-items: center; }
.percent-input input { flex: 1; }.percent-input span { margin-left: -28px; color: var(--muted); }
.bonus-category-grid { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 8px; }
.bonus-category-grid label { cursor: pointer; }
.bonus-category-grid input { position: absolute; opacity: 0; pointer-events: none; }
.bonus-category-grid span { display: block; padding: 5px 9px; border: 1px solid var(--line); border-radius: 999px; background: #fff; font-size: 11px; }
.bonus-category-grid input:checked + span { color: #1e62bd; border-color: #a9cdf8; background: #eaf4ff; }
.shortcut-inline { margin: 18px auto 0; max-width: 640px; }

.asset-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; }
.asset-manager-summary { display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; margin: 20px 0 34px; }
.asset-manager-summary div { padding: 18px 20px; border-radius: 18px; background: #fff; box-shadow: var(--shadow-sm); }
.asset-manager-summary small, .asset-manager-summary strong { display: block; }.asset-manager-summary small { color: var(--muted); }.asset-manager-summary strong { margin-top: 4px; font-size: 23px; }
.position-section { margin: 32px 0; scroll-margin-top: 85px; }
.position-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 14px; margin-top: 14px; }
.position-card {
  padding: 20px; border: 1px solid var(--line); border-radius: 20px;
  background: linear-gradient(155deg,#fff 68%,#f7f9fb);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.position-card:hover { transform: translateY(-2px); border-color: #ced8e2; box-shadow: 0 16px 34px rgba(31,42,55,.09); }
.position-head { display: flex; justify-content: space-between; gap: 14px; }.position-head small { color: var(--muted); }.position-head h3 { margin: 2px 0 0; }.position-head > strong { font-size: 20px; }
.position-card > p { margin: 18px 0 3px; }.position-card > small { color: var(--muted); }
.position-actions { display: flex; flex-wrap: wrap; align-items: start; gap: 8px; margin-top: 18px; }
.position-actions button, .position-actions summary { padding: 7px 10px; border: 1px solid var(--line); border-radius: 9px; background: #fafafa; cursor: pointer; font-size: 12px; list-style: none; }
.position-actions details[open] { width: 100%; order: 5; }.position-actions details[open] summary { margin-bottom: 8px; }
.trade-entry-form { display: grid; gap: 11px; padding: 14px; border: 1px solid #e2e7eb; border-radius: 14px; background: #f8fafb; }
.trade-entry-form label { display: grid; gap: 5px; color: var(--muted); font-size: 11px; }
.trade-entry-form input, .trade-entry-form select { width: 100%; min-width: 0; background: #fff; }
.trade-help { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.55; }
.trade-history { margin-top: 16px; padding-top: 12px; border-top: 1px dashed #dfe4e8; }
.trade-history > summary { color: #496d94; cursor: pointer; font-size: 12px; font-weight: 650; }
.trade-history > div { display: grid; gap: 0; margin-top: 10px; }
.trade-history article { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid #edf0f2; }
.trade-history article > div:last-child { text-align: right; }
.trade-history b, .trade-history small { display: block; }
.trade-history b { font-size: 11px; }.trade-history small { color: var(--muted); font-size: 9px; }
.trade-type { padding: 4px 7px; border-radius: 999px; font-size: 9px; font-weight: 750; }
.trade-type.buy { color: #2f7658; background: #e8f5ee; }
.trade-type.sell { color: #a9544c; background: #fff0ee; }
.position-empty { grid-column: 1 / -1; }
.new-position-card { padding: 22px; border: 1px solid var(--line); border-radius: 22px; background: #fff; }
.new-position-card > summary { cursor: pointer; font-weight: 700; }
.asset-entry-form { display: grid; grid-template-columns: repeat(3,1fr); gap: 14px; margin-top: 18px; }
.asset-entry-form label { display: grid; gap: 5px; color: var(--muted); font-size: 12px; }
.asset-entry-form input, .asset-entry-form select { min-width: 0; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: #fafafa; }
.form-help { margin: 12px 0 0; color: var(--muted); font-size: 12px; }

@media (max-width: 820px) {
  .asset-card-grid { grid-template-columns: repeat(2,1fr); }
  .monthly-grid, .allocation-card { grid-template-columns: 1fr; }
  .budget-line { grid-template-columns: 1fr 44px; }.budget-line progress { grid-column: 1; }.budget-line > strong { grid-column: 2; grid-row: 2; }
  .settings-heading, .asset-heading { align-items: stretch; flex-direction: column; }
  .position-grid { grid-template-columns: 1fr; }
  .asset-entry-form { grid-template-columns: repeat(2,1fr); }
  .floating-add { bottom: 84px; right: 18px; width: 58px; padding: 0; justify-content: center; }.floating-add b { display: none; }
}
@media (max-width: 520px) {
  .dashboard-intro { align-items: stretch; flex-direction: column; }
  .wealth-hero { border-radius: 24px; }.wealth-main > strong { margin-top: 10px; }
  .goal-editor { position: static; margin-top: 20px; }.goal-editor[open] { width: 100%; }
  .asset-card-grid { gap: 9px; }.asset-kpi { padding: 15px; }.asset-kpi em { display: none; }
  .asset-kpi strong { font-size: 19px; }
  .allocation-row { grid-template-columns: 1fr 72px; }.allocation-row > input { grid-column: 1 / -1; grid-row: 2; width: 100%; }
  .asset-manager-summary { grid-template-columns: 1fr; }.asset-entry-form { grid-template-columns: 1fr; }
  .goal-meta { flex-wrap: wrap; }
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  background: var(--bg);
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  opacity: 0;
  animation: pageIn .45s cubic-bezier(.4,0,.2,1) .08s forwards;
}

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

a { color: inherit; text-decoration: none; }

button, input, select { font: inherit; }

/* ─── Header ─── */
.site-header {
  position: sticky; top: 0; z-index: 20;
  border-bottom: 1px solid rgba(0,0,0,.06);
  background: rgba(250,250,252,.78);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  transition: box-shadow var(--transition-base);
}
.site-header.scrolled {
  box-shadow: 0 1px 8px rgba(0,0,0,.06);
}

.header-inner {
  width: min(1120px, calc(100% - 40px)); height: 60px; margin: auto;
  display: flex; align-items: center; gap: 28px;
}

.brand {
  display: flex; align-items: center; gap: 9px; margin-right: auto;
  font-weight: 720; letter-spacing: -.02em;
  transition: transform var(--transition-fast);
}
.brand:hover { transform: scale(1.02); }

.brand-mark {
  width: 30px; height: 30px; display: grid; place-items: center;
  color: white; border-radius: 9px; background: linear-gradient(145deg, #313136, #111113);
  font-size: 13px; font-weight: 750;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}
.brand:hover .brand-mark {
  transform: rotate(-3deg) scale(1.08);
  box-shadow: 0 4px 12px rgba(0,0,0,.15);
}

.desktop-nav { display: flex; align-items: center; gap: 2px; }
.desktop-nav a {
  padding: 7px 12px; border-radius: 9px; color: #515154; font-size: 13px;
  transition: color var(--transition-fast), background var(--transition-fast), transform var(--transition-fast);
}
.desktop-nav a:hover {
  color: var(--ink); background: rgba(0,0,0,.045); transform: translateY(-1px);
}
.desktop-nav a:active { transform: translateY(0); }

.logout-form { margin: 0; }

.icon-button {
  min-height: 32px; padding: 5px 10px; border: 0; border-radius: 9px;
  color: var(--muted); background: transparent; cursor: pointer; font-size: 12px;
  transition: color var(--transition-fast), background var(--transition-fast);
}
.icon-button:hover { color: var(--ink); background: rgba(0,0,0,.045); }

/* ─── Layout ─── */
.container {
  width: min(1120px, calc(100% - 40px));
  min-height: calc(100vh - 60px); margin: auto; padding: 32px 0 80px;
}

h1, h2, h3, p { margin-top: 0; }

h1 {
  margin-bottom: 0;
  font-size: clamp(30px, 4vw, 42px); line-height: 1.1; letter-spacing: -.045em;
}

h2 { margin-bottom: 0; font-size: 21px; line-height: 1.2; letter-spacing: -.025em; }

h3 { margin-bottom: 0; font-size: 17px; line-height: 1.3; }

.eyebrow {
  display: block; margin-bottom: 6px;
  color: var(--muted); font-size: 11px; font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase;
}

.overline { margin: 0 0 4px; color: var(--muted); font-size: 12px; font-weight: 600; }

.subtle, .muted, .empty { color: var(--muted); }

/* ─── Page headings ─── */
.overview-head, .list-head {
  margin: 5px 2px 24px; display: flex; align-items: end; justify-content: space-between; gap: 24px;
}
.overview-head h1, .list-head h1 { font-size: 34px; }

.page-heading { margin: 15px 2px 28px; }
.page-heading h1 { margin-bottom: 8px; }
.page-heading p { color: var(--muted); }

/* ─── Month switcher ─── */
.month-switcher { display: flex; gap: 7px; }
.month-switcher input, .month-switcher button { min-height: 36px; padding: 6px 10px; font-size: 12px; }

/* ─── Form elements ─── */
input, select, button {
  min-height: 42px; padding: 9px 11px;
  border: 1px solid #d2d2d7; border-radius: var(--radius-xs);
  color: var(--ink); background: white;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
}

input:focus, select:focus {
  outline: 3px solid rgba(0,113,227,.16); border-color: var(--blue);
}

button { cursor: pointer; font-weight: 650; }
button:active:not(:disabled) { transform: scale(.97); }

.primary-button, button.primary, .button.primary {
  min-height: 42px; padding: 10px 16px; display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: var(--radius-xs); color: white; background: var(--blue);
  box-shadow: 0 5px 16px rgba(0,113,227,.18); font-weight: 680; cursor: pointer;
  transition: background var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
}
.primary-button:hover, button.primary:hover, .button.primary:hover {
  background: #0077ed; box-shadow: 0 8px 24px rgba(0,113,227,.28);
}
.primary-button:disabled, button.primary:disabled {
  opacity: .55; cursor: not-allowed; transform: none !important;
}

button:not(.primary-button):not(.primary):not(.danger-link):not(.icon-button):hover {
  border-color: #b5b5bd; background: #fafafc;
}

.hint { color: var(--muted); font-size: 12px; }

.text-link { color: var(--blue); font-size: 13px; font-weight: 600; transition: opacity var(--transition-fast); }
.text-link:hover { opacity: .75; }

/* ─── Cards ─── */
.top-grid { display: grid; grid-template-columns: minmax(0,1.45fr) minmax(300px,.75fr); gap: 16px; }

.savings-card, .month-card, .rhythm-card, .analysis-card, .assets-card, .bill-sheet, .entry-shell,
.panel, .member-card, .account-card, .plan-row, .auth-card {
  border: 1px solid rgba(0,0,0,.045); border-radius: var(--radius);
  background: var(--card); box-shadow: var(--shadow);
  transition: box-shadow var(--transition-base), transform var(--transition-base);
}

.savings-card:hover, .month-card:hover, .rhythm-card:hover, .analysis-card:hover,
.panel:hover, .member-card:hover, .account-card:hover {
  box-shadow: var(--shadow-hover);
}

/* Card entrance animations */
.savings-card, .month-card, .rhythm-card, .analysis-card, .assets-card,
.panel, .member-card, .account-card, .plan-row, .bill-sheet, .entry-shell, .auth-card {
  opacity: 0;
  animation: cardIn .55s cubic-bezier(.4,0,.2,1) forwards;
}

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

/* Stagger children */
.top-grid > *:nth-child(1) { animation-delay: .05s; }
.top-grid > *:nth-child(2) { animation-delay: .12s; }
.rhythm-grid > *:nth-child(1) { animation-delay: .08s; }
.rhythm-grid > *:nth-child(2) { animation-delay: .15s; }
.rhythm-grid > *:nth-child(3) { animation-delay: .22s; }
.analysis-grid > *:nth-child(1) { animation-delay: .06s; }
.analysis-grid > *:nth-child(2) { animation-delay: .13s; }
.analysis-grid > *:nth-child(3) { animation-delay: .20s; }

.savings-card { position: relative; padding: 27px; overflow: hidden; }
.savings-card::after {
  content: ""; position: absolute; width: 220px; height: 220px; right: -105px; top: -115px;
  border-radius: 50%; background: linear-gradient(145deg, rgba(0,113,227,.10), rgba(118,87,214,.06));
  animation: floatOrb 8s ease-in-out infinite;
}
@keyframes floatOrb {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-8px, 6px) scale(1.03); }
}

.month-card { padding: 25px; }

.card-title-row, .mini-head, .chart-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.card-title-row > div, .mini-head > div { display: flex; align-items: center; gap: 11px; }
.card-title-row small, .card-title-row h2, .mini-head small, .mini-head strong { display: block; }
.card-title-row small, .mini-head small, .chart-head small { color: var(--muted); font-size: 12px; }
.card-title-row > b { position: relative; z-index: 1; font-size: 27px; letter-spacing: -.04em; }

.soft-icon {
  width: 38px; height: 38px; display: grid; place-items: center;
  border-radius: 12px; color: var(--blue); background: var(--blue-soft); font-weight: 750;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}
.soft-icon.green { color: var(--green); background: #e9f7f1; }
.soft-icon.orange { color: var(--orange); background: #fff1e5; }
.soft-icon.blue { color: var(--blue); background: var(--blue-soft); }
.soft-icon.purple { color: var(--purple); background: #f0ecff; }
.soft-icon.gold { color: var(--gold); background: #fff5d6; }

/* Soft icon subtle pulse on parent hover */
.savings-card:hover .soft-icon,
.month-card:hover .soft-icon,
.rhythm-card:hover .soft-icon {
  transform: scale(1.08);
}

/* ─── Savings ─── */
.savings-amount { margin: 28px 0 13px; display: flex; align-items: baseline; gap: 12px; }
.savings-amount strong {
  font-size: clamp(35px,5vw,50px); line-height: 1; letter-spacing: -.055em;
  transition: color var(--transition-base);
}
.savings-amount span { color: var(--muted); }

progress {
  width: 100%; height: 9px; overflow: hidden; border: 0; border-radius: 999px; background: #ececf0;
}
progress::-webkit-progress-bar { border-radius: 999px; background: #ececf0; }
progress::-webkit-progress-value {
  border-radius: 999px; background: linear-gradient(90deg, #1677e8, #6f6ee8);
  transition: width .8s cubic-bezier(.4,0,.2,1);
}
progress::-moz-progress-bar {
  border-radius: 999px; background: linear-gradient(90deg, #1677e8, #6f6ee8);
}

.savings-progress { height: 13px; }
.savings-meta { margin-top: 9px; display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; }

.contribute-form { margin-top: 22px; display: flex; align-items: end; gap: 9px; }
.contribute-form label { flex: 1; }

.money-field {
  display: flex; align-items: center;
  border: 1px solid #d2d2d7; border-radius: var(--radius-xs); background: white;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.money-field:focus-within {
  border-color: var(--blue); box-shadow: 0 0 0 3px rgba(0,113,227,.12);
}
.money-field b { padding-left: 11px; color: var(--muted); }
.money-field input { border: 0; }

label { display: grid; gap: 6px; color: #49494d; font-size: 13px; font-weight: 600; }

.edit-details, .add-details { margin-top: 15px; }
.edit-details summary, .add-details summary {
  color: var(--blue); cursor: pointer; font-size: 12px; font-weight: 600;
  transition: opacity var(--transition-fast);
}
.edit-details summary:hover, .add-details summary:hover { opacity: .7; }

.compact-form, .goal-setup {
  margin-top: 13px; display: grid; grid-template-columns: repeat(2,1fr); gap: 10px;
}
.compact-form button, .goal-setup button { align-self: end; }
.goal-setup { margin-top: 22px; }

.status-dot {
  width: 9px; height: 9px; border-radius: 50%; background: #34c759;
  box-shadow: 0 0 0 5px rgba(52,199,89,.12);
  animation: pulseDot 3s ease-in-out infinite;
}
@keyframes pulseDot {
  0%, 100% { box-shadow: 0 0 0 5px rgba(52,199,89,.12); }
  50% { box-shadow: 0 0 0 8px rgba(52,199,89,.06); }
}

.net-amount { margin: 30px 0 25px; }
.net-amount small, .net-amount strong { display: block; }
.net-amount small { color: var(--muted); }
.net-amount strong { margin-top: 3px; font-size: 38px; letter-spacing: -.05em; transition: color var(--transition-base); }
.net-amount strong.negative { color: var(--red); }

.income-expense { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.income-expense > div {
  padding: 12px; border-radius: 12px; background: #f7f7f9;
  transition: background var(--transition-fast), transform var(--transition-fast);
}
.income-expense > div:hover { background: #f0f0f4; transform: translateY(-1px); }
.income-expense span, .income-expense b { display: block; }
.income-expense span { color: var(--muted); font-size: 12px; }

.income-dot, .expense-dot {
  width: 7px; height: 7px; display: inline-block; margin-right: 5px;
  border-radius: 50%; background: var(--green);
}
.expense-dot { background: var(--orange); }

.saving-rate { margin: 13px 0; display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; }
.saving-rate b { color: var(--ink); }

/* ─── Section titles ─── */
.section-title { margin: 42px 2px 15px; display: flex; align-items: end; justify-content: space-between; gap: 18px; }
.section-title a { color: var(--blue); font-size: 13px; font-weight: 600; transition: opacity var(--transition-fast); }
.section-title a:hover { opacity: .75; }

/* ─── Rhythm grid ─── */
.rhythm-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 14px; align-items: start; }
.rhythm-card { padding: 21px; min-height: 260px; }

.mini-head { justify-content: flex-start; }
.mini-head > div { margin-right: auto; display: block; }
.mini-head a { color: var(--blue); font-size: 12px; transition: opacity var(--transition-fast); }
.mini-head a:hover { opacity: .7; }

.budget-stack { margin-top: 20px; display: grid; gap: 16px; }

.budget-mini > div { display: flex; align-items: center; gap: 6px; }
.budget-mini > div small { margin-left: auto; color: var(--muted); }
.budget-mini progress { margin: 7px 0 2px; height: 6px; }
.budget-mini p { margin: 0; color: var(--muted); text-align: right; font-size: 11px; }

.member-dot { width: 8px; height: 8px; border-radius: 50%; transition: transform var(--transition-fast); }
.member-dot[data-color="#6C7BFF"], .member-avatar[data-color="#6C7BFF"] { background: #6C7BFF; }
.member-dot[data-color="#FF8A65"], .member-avatar[data-color="#FF8A65"] { background: #FF8A65; }
.member-dot[data-color="#2DBE8C"], .member-avatar[data-color="#2DBE8C"] { background: #2DBE8C; }
.member-dot[data-color="#B56CE2"], .member-avatar[data-color="#B56CE2"] { background: #B56CE2; }
.member-dot[data-color="#E9A23B"], .member-avatar[data-color="#E9A23B"] { background: #E9A23B; }
.member-dot[data-color="#EC6F91"], .member-avatar[data-color="#EC6F91"] { background: #EC6F91; }

.family-row:hover .member-dot { transform: scale(1.4); }

.mini-empty { margin-top: 34px; padding: 20px; text-align: center; border-radius: 14px; background: #f7f7f9; }
.mini-empty p { margin-bottom: 5px; color: var(--muted); }
.mini-empty a { color: var(--blue); }

/* ─── Recurring ─── */
.recurring-list { margin-top: 16px; }
.recurring-item { border-bottom: 1px solid var(--line); }
.recurring-item summary {
  padding: 11px 0; display: grid; grid-template-columns: auto 1fr auto;
  align-items: center; gap: 9px; cursor: pointer; list-style: none;
  transition: background var(--transition-fast), padding var(--transition-fast);
  border-radius: 8px;
}
.recurring-item summary:hover { background: #f7f7f9; padding-left: 8px; padding-right: 8px; }
.recurring-item summary::-webkit-details-marker { display: none; }
.recurring-item summary div b, .recurring-item summary div small { display: block; }
.recurring-item summary div small { color: var(--muted); font-size: 11px; }

.category-symbol, .category-icon {
  width: 36px; height: 36px; display: grid; place-items: center; flex: 0 0 auto;
  border-radius: 11px; color: #3e3e43; background: #f0f0f3; font-size: 16px; font-weight: 700;
  transition: transform var(--transition-fast), background var(--transition-fast);
}
.category-symbol:hover, .category-icon:hover { transform: scale(1.08); }

.delete-line { margin: 5px 0 12px; }

.danger-link {
  min-height: auto; padding: 3px; color: var(--red); border: 0; background: transparent;
  font-size: 12px; box-shadow: none; transition: opacity var(--transition-fast);
}
.danger-link:hover { opacity: .75; }

/* ─── Family list ─── */
.family-list { margin-top: 20px; display: grid; gap: 13px; }
.family-row {
  display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center;
  padding: 6px 8px; margin: -6px -8px; border-radius: 10px;
  transition: background var(--transition-fast);
}
.family-row:hover { background: #f7f7f9; }

.member-avatar {
  width: 38px; height: 38px; display: grid; place-items: center;
  color: white; border-radius: 12px; font-weight: 700;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}
.member-avatar.large { width: 58px; height: 58px; border-radius: 17px; font-size: 20px; }
.member-avatar.compact { width: 34px; height: 34px; }

.family-row:hover .member-avatar { transform: scale(1.06); }

.family-row div b, .family-row div small { display: block; }
.family-row div small, .family-row > span:last-child { color: var(--muted); font-size: 11px; }

/* ─── Analysis ─── */
.analysis-title { margin-top: 46px; }
.analysis-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 14px; }
.analysis-card { padding: 22px; min-height: 320px; }
.analysis-card.wide-card { grid-column: 1 / -1; }

.chart-head { margin-bottom: 14px; }
.chart-head .legend { display: flex; gap: 13px; color: var(--muted); font-size: 11px; }

.chart-wrap { position: relative; height: 260px; }
.chart-wrap.donut { height: 240px; }

.income-bars { margin-top: 18px; display: grid; }
.income-bars > div {
  padding: 14px 0; display: flex; justify-content: space-between;
  border-bottom: 1px solid var(--line);
  transition: padding var(--transition-fast), background var(--transition-fast);
}
.income-bars > div:hover { padding-left: 8px; background: rgba(0,0,0,.015); border-radius: 0 8px 8px 0; }

/* ─── Assets ─── */
.assets-card {
  margin-top: 42px; padding: 27px;
  display: flex; align-items: center; justify-content: space-between; gap: 25px; overflow: hidden;
}
.assets-card > div:first-child { display: flex; gap: 15px; align-items: flex-start; }
.assets-card p { margin-bottom: 0; color: var(--muted); }

.asset-preview { display: grid; grid-template-columns: repeat(2,70px); gap: 7px; }
.asset-preview span {
  padding: 9px; border-radius: 10px; color: var(--muted); background: #f5f5f7;
  text-align: center; font-size: 11px;
  transition: background var(--transition-fast), transform var(--transition-fast), color var(--transition-fast);
}
.asset-preview span:hover { background: #ececf0; transform: translateY(-2px); color: var(--ink); }

/* ─── Bill list ─── */
.list-actions { display: flex; flex-wrap: wrap; gap: 9px; align-items: center; }
.export-button {
  min-height: 42px; padding: 10px 14px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid #d2d2d7; border-radius: var(--radius-xs);
  color: var(--ink); background: white; font-size: 13px; font-weight: 650;
  transition: border-color var(--transition-fast), background var(--transition-fast);
}
.export-button:hover { border-color: #b5b5bd; background: #fafafc; }

.bill-sheet { padding: 10px 24px 24px; }

.bill-date {
  padding: 22px 4px 7px; color: var(--muted); font-size: 12px; font-weight: 600;
  position: relative;
}
.bill-date::after {
  content: ""; position: absolute; bottom: 0; left: 0; right: 0;
  height: 1px; background: linear-gradient(90deg, var(--line), transparent);
}

.bill-row {
  position: relative; min-height: 67px;
  display: grid; grid-template-columns: auto 1fr auto auto;
  gap: 12px; align-items: center;
  border-bottom: 1px solid var(--line);
  padding: 0 8px; margin: 0 -8px;
  border-radius: 10px;
  transition: background var(--transition-fast), transform var(--transition-fast);
}
.bill-row:hover { background: #f7f7f9; transform: translateX(2px); }
.bill-row:has(.bill-menu[open]) {
  z-index: 20; background: #f7f7f9;
}

.bill-main strong, .bill-main small { display: block; }
.bill-main small { color: var(--muted); font-size: 12px; }

.bill-amount { min-width: 92px; text-align: right; }
.bill-amount.income { color: var(--green); }
.bill-amount.expense { color: var(--orange); }

.bill-menu { position: relative; }
.bill-menu[open] { z-index: 30; }
.bill-menu > summary {
  width: 30px; padding: 6px; cursor: pointer; list-style: none;
  color: var(--muted); text-align: center; border-radius: 8px;
  transition: background var(--transition-fast), color var(--transition-fast);
}
.bill-menu > summary:hover { background: #ececf0; color: var(--ink); }
.bill-menu > summary::-webkit-details-marker { display: none; }

.bill-menu > div {
  position: absolute; right: 0; top: 32px; z-index: 5; width: 250px; padding: 14px;
  border: 1px solid var(--line); border-radius: 14px;
  background: white; box-shadow: 0 14px 35px rgba(0,0,0,.14);
  animation: menuIn .2s cubic-bezier(.4,0,.2,1);
}
@keyframes menuIn {
  from { opacity: 0; transform: translateY(-6px) scale(.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.bill-menu form { display: grid; gap: 8px; margin-bottom: 9px; }
.bill-menu form + form { padding-top: 12px; border-top: 1px solid var(--line); }
.bill-edit-note { color: var(--muted); font-size: 10px; line-height: 1.45; }

/* ─── Empty states ─── */
.empty-state { padding: 60px 20px; text-align: center; }
.empty-state > span {
  width: 50px; height: 50px; margin: auto auto 13px; display: grid; place-items: center;
  border-radius: 15px; color: var(--blue); background: var(--blue-soft); font-size: 22px;
  animation: iconPop .5s cubic-bezier(.4,0,.2,1) .2s both;
}
@keyframes iconPop {
  from { opacity: 0; transform: scale(.6); }
  to { opacity: 1; transform: scale(1); }
}
.empty-state h2, .empty-state h3 { margin-bottom: 6px; }
.empty-state p { color: var(--muted); }

/* ─── Entry form ─── */
.entry-shell { width: min(660px,100%); margin: 8px auto; padding: 30px; }

.entry-head { margin-bottom: 24px; }
.entry-head > a {
  display: inline-block; margin-bottom: 24px; color: var(--blue); font-size: 13px;
  transition: transform var(--transition-fast), opacity var(--transition-fast);
}
.entry-head > a:hover { opacity: .75; transform: translateX(-3px); }

.entry-form { display: grid; gap: 19px; }

.type-segment {
  padding: 3px; display: grid; grid-template-columns: 1fr 1fr;
  border-radius: var(--radius-xs); background: #ededf0;
}
.type-segment label { display: block; }
.type-segment input { position: absolute; opacity: 0; pointer-events: none; }
.type-segment span {
  min-height: 36px; display: grid; place-items: center;
  border-radius: 9px; color: var(--muted); cursor: pointer;
  transition: all var(--transition-fast);
}
.type-segment span:hover { color: var(--ink); }
.type-segment input:checked + span {
  color: var(--ink); background: white; box-shadow: 0 1px 5px rgba(0,0,0,.09);
  animation: segmentPop .25s cubic-bezier(.4,0,.2,1);
}
@keyframes segmentPop {
  0% { transform: scale(.97); }
  50% { transform: scale(1.02); }
  100% { transform: scale(1); }
}

.big-amount > div {
  display: flex; align-items: center;
  border-bottom: 1px solid var(--line);
  transition: border-color var(--transition-base);
}
.big-amount > div:focus-within { border-bottom-color: var(--blue); }
.big-amount b { color: var(--muted); font-size: 26px; }
.big-amount input {
  min-height: 74px; border: 0; font-size: 46px; font-weight: 650; letter-spacing: -.045em;
  transition: color var(--transition-base);
}
.big-amount input:focus { outline: 0; color: var(--blue); }
.big-amount input::placeholder { color: #d2d2d7; }

.description-field small {
  color: var(--blue); font-weight: 500;
  transition: opacity var(--transition-fast);
}
.description-field small.suggested { color: var(--green); font-weight: 600; }
.description-field small.loading { opacity: .5; }

.entry-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.category-field { margin: 0; padding: 0; border: 0; }
.category-field legend { margin-bottom: 11px; font-weight: 650; }
.category-field legend small { color: var(--muted); font-weight: 400; }

.category-grid { display: grid; grid-template-columns: repeat(5,1fr); gap: 8px; }

.category-choice {
  position: relative; padding: 10px 5px;
  display: grid; place-items: center; gap: 5px;
  border: 1px solid var(--line); border-radius: 13px; cursor: pointer;
  transition: all var(--transition-fast);
}
.category-choice:hover {
  border-color: #d2d2d7; background: #fafafc; transform: translateY(-2px);
}
.category-choice input { position: absolute; opacity: 0; }
.category-choice b { font-size: 11px; font-weight: 550; }
.category-choice .category-icon { transition: all var(--transition-fast); }

.category-choice:has(input:checked), .category-choice.suggested {
  border-color: var(--blue); background: var(--blue-soft);
  animation: choicePop .3s cubic-bezier(.4,0,.2,1);
}
@keyframes choicePop {
  0% { transform: scale(.92); }
  60% { transform: scale(1.04); }
  100% { transform: scale(1); }
}

.category-choice:has(input:checked) .category-icon { color: white; background: var(--blue); }
.category-choice[hidden] { display: none; }

.entry-submit { width: 100%; min-height: 48px; font-size: 16px; }

/* ─── Panel & Grid ─── */
.panel { padding: 24px; }

.two-column, .dashboard-grid { display: grid; grid-template-columns: 1fr 1.4fr; gap: 16px; align-items: start; }

.sticky-form { position: sticky; top: 82px; }

.stack { display: grid; gap: 14px; }

/* ─── Plans & Members ─── */
.plan-row {
  margin-bottom: 10px; padding: 17px;
  display: grid; grid-template-columns: auto 1fr auto auto;
  gap: 12px; align-items: center;
}
.plan-row:hover { transform: translateX(2px); }
.plan-row small { color: var(--muted); }

.input-suffix, .money-input {
  display: flex; align-items: center;
  border: 1px solid #d2d2d7; border-radius: var(--radius-xs); background: white; overflow: hidden;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.input-suffix:focus-within, .money-input:focus-within {
  border-color: var(--blue); box-shadow: 0 0 0 3px rgba(0,113,227,.12);
}
.input-suffix input, .money-input input { border: 0; }
.input-suffix span, .money-input b { padding: 0 11px; color: var(--muted); }

.member-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(290px,1fr)); gap: 15px; }

.member-card { padding: 23px; }
.member-card-head { margin-bottom: 20px; display: flex; align-items: center; gap: 12px; }
.member-card-head h2 { margin: 0; }

.add-member {
  border-style: dashed; box-shadow: none;
  transition: all var(--transition-base);
}
.add-member:hover { border-color: rgba(0,0,0,.12); background: #fafafc; }
.add-member .member-avatar { transition: all var(--transition-fast); }
.add-member:hover .member-avatar { background: #e0e0e6 !important; transform: rotate(90deg); }

.account-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(180px,1fr)); gap: 10px; }

.account-card { padding: 18px; }
.account-card span, .account-card strong, .account-card small { display: block; }
.account-card strong { margin: 4px 0; font-size: 22px; transition: color var(--transition-fast); }
.account-card:hover strong { color: var(--blue); }
.account-opening-editor { margin-top: 13px; padding-top: 11px; border-top: 1px solid var(--line); }
.account-opening-editor > summary { color: var(--blue); cursor: pointer; list-style: none; font-size: 12px; font-weight: 650; }
.account-opening-editor > summary::-webkit-details-marker { display: none; }
.account-opening-editor form { display: grid; gap: 8px; margin-top: 11px; }
.account-opening-editor label { display: grid; gap: 4px; color: var(--muted); font-size: 11px; }
.account-opening-editor input { width: 100%; min-width: 0; }
.account-opening-editor p { margin: 8px 0 0; color: var(--muted); font-size: 10px; line-height: 1.5; }
.opening-balance-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

/* ─── Auth ─── */
.auth-card { width: min(420px,100%); margin: 7vh auto; padding: 32px; }
.auth-card .eyebrow { margin-bottom: 10px; }
.auth-card h1 { margin-bottom: 8px; }
.auth-card .muted { margin-bottom: 24px; }

.remember-row { display: flex; align-items: flex-start; gap: 8px; }
.remember-row input { width: 18px; min-height: 18px; margin-top: 2px; }
.remember-row small { display: block; color: var(--muted); font-weight: 400; }

/* ─── Shortcut page ─── */
.shortcut-hero { display: grid; grid-template-columns: .7fr 1.3fr; gap: 16px; }

.phone-mock {
  padding: 25px; color: white; border-radius: 32px;
  background: linear-gradient(145deg,#6176e8,#a45ec4);
  position: relative; overflow: hidden;
  animation: phoneGlow 4s ease-in-out infinite;
}
@keyframes phoneGlow {
  0%, 100% { box-shadow: 0 8px 32px rgba(97,118,232,.25); }
  50% { box-shadow: 0 12px 48px rgba(164,94,196,.3); }
}

.phone-mock::before {
  content: ""; position: absolute; top: -50%; left: -50%; width: 200%; height: 200%;
  background: radial-gradient(circle at 30% 20%, rgba(255,255,255,.08) 0%, transparent 50%);
  pointer-events: none;
}

.phone-island {
  width: 96px; height: 28px; margin: 0 auto 20px;
  background: rgba(0,0,0,.35); border-radius: 14px;
}

.shortcut-question {
  margin-top: 16px; padding: 12px 16px;
  background: rgba(255,255,255,.12); border-radius: 14px;
  font-size: 13px; backdrop-filter: blur(8px);
  animation: msgIn .4s cubic-bezier(.4,0,.2,1) .3s both;
}
.shortcut-answer {
  margin-top: 8px; padding: 12px 16px;
  background: rgba(255,255,255,.18); border-radius: 14px;
  font-size: 20px; font-weight: 650;
  animation: msgIn .4s cubic-bezier(.4,0,.2,1) .5s both;
}
.shortcut-result {
  margin-top: 8px; padding: 10px 14px;
  background: rgba(52,199,89,.25); border-radius: 12px;
  font-size: 12px; text-align: center;
  animation: msgIn .4s cubic-bezier(.4,0,.2,1) .7s both;
}
@keyframes msgIn {
  from { opacity: 0; transform: translateY(8px) scale(.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.shortcut-guide { padding: 26px; }
.shortcut-guide li { margin: 10px 0; }
.shortcut-guide li b { display: inline-block; margin-right: 6px; }
.shortcut-guide li span { color: var(--muted); }

.privacy-note {
  margin-top: 16px; padding: 12px 14px;
  background: #fff5d6; border-radius: 10px;
  color: var(--gold); font-size: 12px;
}

.token-panel { margin-top: 16px; }

.panel-heading {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px;
}
.panel-heading h2 { margin: 0; }

.status-pill {
  padding: 4px 10px; border-radius: 999px;
  background: #e6f7ef; color: var(--green);
  font-size: 11px; font-weight: 600;
  animation: pillIn .3s cubic-bezier(.4,0,.2,1);
}
@keyframes pillIn {
  from { opacity: 0; transform: scale(.85); }
  to { opacity: 1; transform: scale(1); }
}

.token-reveal code, .setup-values code {
  display: block; padding: 10px; overflow-wrap: anywhere;
  border-radius: 8px; background: #f5f5f7;
  font-family: "SF Mono", "SFMono-Regular", "PingFang SC", Consolas, monospace;
  font-size: 12px;
  transition: background var(--transition-fast);
}
.token-reveal code:hover, .setup-values code:hover { background: #ececf0; }

.copy-button {
  margin-top: 10px;
  transition: all var(--transition-fast);
}
.copy-button.copied {
  background: var(--green) !important; box-shadow: 0 4px 12px rgba(34,160,107,.25) !important;
}

.inline-actions { display: flex; gap: 10px; align-items: center; margin-top: 12px; }

.setup-values { margin-top: 12px; }
.setup-values p { margin: 8px 0; }
.setup-values p b { display: block; margin-bottom: 4px; font-size: 12px; color: var(--muted); }

/* ─── Flash messages ─── */
.flash {
  margin-bottom: 14px; padding: 11px 14px; border-radius: 12px;
  animation: flashIn .35s cubic-bezier(.4,0,.2,1);
  position: relative;
}
@keyframes flashIn {
  from { opacity: 0; transform: translateY(-8px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.flash.success { color: #176746; background: #e6f7ef; }
.flash.error { color: #963d3d; background: #ffebe9; }
.flash::before {
  content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px;
  border-radius: 0 3px 3px 0;
}
.flash.success::before { background: var(--green); }
.flash.error::before { background: var(--red); }

/* ─── Toast notifications ─── */
.toast-container {
  position: fixed; top: 72px; right: 20px; z-index: 100;
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}
.toast {
  padding: 12px 18px; border-radius: 14px;
  background: rgba(29,29,31,.88); backdrop-filter: blur(20px);
  color: white; font-size: 13px; font-weight: 500;
  box-shadow: 0 8px 24px rgba(0,0,0,.2);
  pointer-events: auto;
  animation: toastIn .35s cubic-bezier(.4,0,.2,1);
  max-width: 320px;
}
.toast.toast-out { animation: toastOut .3s cubic-bezier(.4,0,.2,1) forwards; }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px) scale(.96); }
  to { opacity: 1; transform: translateX(0) scale(1); }
}
@keyframes toastOut {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(20px); }
}

/* ─── Skeleton loading ─── */
.skeleton {
  background: linear-gradient(90deg, #f0f0f3 25%, #e8e8ed 50%, #f0f0f3 75%);
  background-size: 200% 100%;
  border-radius: 8px;
  animation: skeletonShimmer 1.4s ease-in-out infinite;
}
@keyframes skeletonShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ─── Loading spinner ─── */
.spinner {
  width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.35);
  border-top-color: white; border-radius: 50%;
  animation: spin .7s linear infinite; display: inline-block; vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Number count animation helper ─── */
.count-up { display: inline-block; }

/* ─── Mobile nav ─── */
.mobile-nav { display: none; }

/* ─── Reduced motion ─── */
@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
  }
  body { opacity: 1; animation: none; }
  .savings-card::after { animation: none; }
}

/* ─── Responsive ─── */
@media (max-width: 900px) {
  .desktop-nav { display: none; }
  .top-grid, .rhythm-grid { grid-template-columns: 1fr; }
  .rhythm-card { min-height: auto; }
  .analysis-grid { grid-template-columns: 1fr; }
  .analysis-card.wide-card { grid-column: auto; }
  .two-column, .dashboard-grid, .shortcut-hero { grid-template-columns: 1fr; }
  .sticky-form { position: static; }
}

@media (max-width: 640px) {
  body { padding-bottom: calc(70px + env(safe-area-inset-bottom)); }
  .header-inner, .container { width: calc(100% - 24px); }
  .container { padding-top: 20px; }
  .overview-head, .list-head { align-items: flex-start; flex-direction: column; }
  .overview-head { flex-direction: row; align-items: end; }
  .overview-head h1 { font-size: 29px; }
  .month-switcher input { max-width: 135px; }
  .savings-card, .month-card { padding: 20px; border-radius: 19px; }
  .savings-amount { margin-top: 24px; display: block; }
  .savings-amount strong { display: block; margin-bottom: 5px; }
  .contribute-form { align-items: stretch; flex-direction: column; }
  .compact-form, .goal-setup { grid-template-columns: 1fr; }
  .section-title { margin-top: 34px; }
  .section-title h2 { font-size: 19px; }
  .rhythm-grid { gap: 10px; }
  .analysis-grid { gap: 10px; }
  .analysis-card { min-height: 280px; padding: 18px; }
  .chart-wrap { height: 225px; }
  .assets-card { align-items: flex-start; flex-direction: column; }
  .asset-preview { width: 100%; grid-template-columns: repeat(4,1fr); }
  .list-actions { width: 100%; display: grid; grid-template-columns: 1fr 1fr; }
  .list-actions .month-switcher { grid-column: 1 / -1; }
  .list-actions .month-switcher input { flex: 1; max-width: none; min-width: 0; }
  .bill-sheet { padding: 6px 16px 20px; border-radius: 18px; }
  .bill-row { grid-template-columns: auto 1fr auto; }
  .bill-menu { grid-column: 3; grid-row: 1; align-self: start; }
  .bill-amount { grid-column: 3; grid-row: 2; }
  .bill-menu > div { right: -4px; }
  .entry-shell { padding: 20px; border-radius: 19px; }
  .big-amount input { font-size: 40px; }
  .entry-pair { grid-template-columns: 1fr 1fr; }
  .category-grid { grid-template-columns: repeat(4,1fr); }
  .plan-row { grid-template-columns: auto 1fr auto; }

  .mobile-nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 25;
    min-height: 67px; padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    display: grid; grid-template-columns: repeat(5,1fr); align-items: end;
    border-top: 1px solid rgba(0,0,0,.08);
    background: rgba(250,250,252,.88); backdrop-filter: saturate(180%) blur(20px);
    animation: navSlideUp .4s cubic-bezier(.4,0,.2,1);
  }
  @keyframes navSlideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
  }
  .mobile-nav a {
    display: grid; place-items: center; gap: 2px;
    color: var(--muted); font-size: 10px;
    transition: color var(--transition-fast), transform var(--transition-fast);
    padding: 4px 0; border-radius: 8px;
  }
  .mobile-nav a:hover, .mobile-nav a:active { color: var(--blue); }
  .mobile-nav a.active { color: var(--blue); }
  .mobile-nav span { font-size: 19px; line-height: 1; transition: transform var(--transition-fast); }
  .mobile-nav a:active span { transform: scale(.88); }
  .mobile-nav .mobile-add span {
    width: 42px; height: 42px; margin-top: -15px; display: grid; place-items: center;
    color: white; border-radius: 14px; background: var(--blue);
    box-shadow: 0 8px 20px rgba(0,113,227,.28);
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  }
  .mobile-nav .mobile-add:active span { transform: scale(.92); box-shadow: 0 4px 12px rgba(0,113,227,.2); }

  .toast-container { top: auto; bottom: 82px; right: 12px; left: 12px; }
  .toast { max-width: 100%; text-align: center; }
}

/* ─── V5: refined family finance experience ─── */
body { background: #f3f4f6; color: #20242a; }
.container { width: min(1180px, calc(100% - 44px)); }
.v5-intro { align-items: center; }
.intro-actions { display: flex; align-items: center; gap: 10px; }
.intro-actions form { margin: 0; }
.refresh-all-button {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 38px; padding: 8px 14px; border: 1px solid #dfe2e7;
  border-radius: 12px; color: #344054; background: #fff; cursor: pointer;
  box-shadow: 0 4px 14px rgba(31,42,55,.06);
}
.refresh-all-button:hover { color: #1d5b8f; border-color: #b8cee2; transform: translateY(-1px); }
.wealth-hero-v5 {
  display: grid; grid-template-columns: 1.2fr .8fr; align-items: end; gap: 42px;
  min-height: 355px; padding: 48px;
  background:
    radial-gradient(circle at 92% 4%, rgba(133,164,207,.29), transparent 32%),
    radial-gradient(circle at 50% 120%, rgba(98,157,137,.18), transparent 40%),
    linear-gradient(140deg, #152130, #1b3042 57%, #233b4d);
}
.today-change {
  display: inline-flex; margin: -12px 0 28px; padding: 5px 10px;
  color: #85d8b9; border-radius: 999px; background: rgba(92,190,154,.12); font-size: 12px;
}
.today-change.down { color: #efaa9f; background: rgba(220,112,97,.12); }
.hero-curve { position: relative; z-index: 1; height: 215px; min-width: 0; }
.hero-curve > div { display: flex; justify-content: space-between; color: rgba(255,255,255,.58); font-size: 11px; }
.hero-curve > div b { color: rgba(255,255,255,.8); font-weight: 600; }
.hero-curve canvas { margin-top: 8px; width: 100% !important; height: 185px !important; }
.v5-assets { margin-top: -22px; position: relative; z-index: 3; }
.v5-assets .asset-kpi { padding: 21px; border: 1px solid rgba(30,44,59,.055); box-shadow: 0 12px 30px rgba(24,37,51,.075); }
.asset-kpi.dividend .asset-glyph { color: #4f7c67; background: #e8f1ec; }
.asset-kpi.us_stock .asset-glyph { color: #6a6090; background: #eeebf5; }
.asset-kpi.active .asset-glyph { color: #986c48; background: #f5ece4; }
.member-avatar.tiny { width: 28px; height: 28px; display: grid; place-items: center; color: #fff; border-radius: 50%; font-size: 11px; font-weight: 700; }
.fixed-card-v5 > details > summary p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.fixed-detail-list { display: grid; gap: 0; margin-top: 18px; border-top: 1px solid var(--line); }
.fixed-detail-list > div { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 11px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.fixed-detail-list b, .fixed-detail-list small { display: block; }.fixed-detail-list small { color: var(--muted); }
.fixed-detail-actions { display: grid; justify-items: end; gap: 3px; }
.fixed-detail-actions form { margin: 0; }

.family-budget-panel { position: relative; padding: 30px; }
.family-budget-overview { display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.family-budget-overview h2 { font-size: 32px; }.family-budget-overview h2 small { color: var(--muted); font-size: 16px; font-weight: 500; }
.family-budget-overview p:last-child { margin: 6px 0 0; color: var(--muted); font-size: 12px; }
.family-budget-overview > strong { font-size: 34px; letter-spacing: -.04em; }
.family-progress { width: 100%; height: 11px; margin: 20px 0 10px; overflow: hidden; border: 0; border-radius: 99px; background: #e8ebef; }
.family-progress::-webkit-progress-bar { background: #e8ebef; }.family-progress::-webkit-progress-value { border-radius: 99px; background: linear-gradient(90deg,#617fac,#72a491); }
.family-progress.over::-webkit-progress-value { background: linear-gradient(90deg,#c77d70,#d85d52); }
.danger-text { color: #c94f47; }
.member-budget-details { margin-top: 8px; }
.member-budget-details > summary { color: #496d94; cursor: pointer; font-size: 13px; }
.panel-corner-link { display: block; margin-top: 18px; color: #496d94; font-size: 12px; }

.allocation-v5 { display: block; padding: 34px; }
.allocation-top { display: grid; grid-template-columns: 1fr 300px; align-items: center; gap: 40px; padding-bottom: 25px; border-bottom: 1px solid var(--line); }
.allocation-pie { position: relative; height: 240px; }
.allocation-pie canvas { width: 100% !important; height: 100% !important; }
.allocation-pie > div { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; pointer-events: none; }
.allocation-pie small { color: var(--muted); }.allocation-pie b { display: block; margin-top: 2px; font-size: 20px; }
.allocation-v5 .allocation-controls { margin-top: 24px; }
.allocation-row-v5 { grid-template-columns: 160px minmax(230px,1fr) 175px; padding: 8px 0; }
.allocation-label { display: grid !important; grid-template-columns: auto 1fr !important; }
.allocation-label small { grid-column: 2; color: var(--muted); font-size: 11px; }
.allocation-slider {
  display: grid !important; grid-template-columns: minmax(120px,1fr) 78px !important;
  align-items: center; gap: 12px !important; min-width: 0;
}
.allocation-slider > input[type="range"] { width: 100%; min-width: 110px; }
.allocation-result { display: grid !important; grid-template-columns: 1fr !important; justify-items: end; text-align: right; }
.allocation-result strong, .allocation-result small { grid-column: 1 !important; }
.allocation-result strong { color: #303943 !important; font-size: 12px !important; }
.allocation-result small { color: #5f8a76; font-size: 11px; }
.allocation-result .gap-alert { color: #c94f47; font-weight: 700; }
.allocation-result .gap-over { color: #9a7457; }
.allocation-warning { margin: 10px 0 0 !important; padding: 9px 11px; color: #b83e38 !important; border-radius: 10px; background: #fff0ee; font-size: 12px; }
.history-card { margin-bottom: 42px; padding: 28px; border-radius: 26px; }
.history-chart { height: 290px; }
.saving-dot { background: #677ead; }

.smart-entry-grid { display: grid; grid-template-columns: 1.12fr .88fr; gap: 16px; margin: 26px 0 42px; }
.smart-entry-card { padding: 26px; border: 1px solid rgba(31,42,55,.06); border-radius: 24px; background: #fff; box-shadow: 0 14px 36px rgba(31,42,55,.075); }
.smart-entry-card > div:first-child { display: flex; align-items: center; gap: 12px; }.smart-entry-card h2 { margin-top: 2px; }
.gold-entry-card { background: linear-gradient(145deg,#fff,#faf6ee); }
.gold-entry-card > p { margin: 20px 0; color: var(--muted); }
.smart-asset-form { display: grid; gap: 13px; margin-top: 20px; }
.smart-asset-form label { display: grid; gap: 5px; color: var(--muted); font-size: 12px; }
.smart-asset-form input, .smart-asset-form select { width: 100%; min-height: 43px; padding: 9px 11px; border: 1px solid #dde1e6; border-radius: 11px; background: #f9fafb; outline: none; }
.smart-asset-form input:focus, .smart-asset-form select:focus { border-color: #8eb1d5; box-shadow: 0 0 0 3px rgba(91,139,188,.1); }
.lookup-result { display: flex; align-items: center; justify-content: space-between; min-height: 45px; padding: 10px 12px; border-radius: 11px; color: var(--muted); background: #f5f6f8; font-size: 12px; }
.lookup-result b, .lookup-result span { display: block; }.lookup-result.success { color: #356d56; background: #eef7f2; }.lookup-result.error { color: #b94e45; background: #fff1ef; }.lookup-result.loading { color: #496d94; }
.manual-fallback { padding-top: 8px; border-top: 1px dashed #e2e4e8; }
.asset-manager-summary.four { grid-template-columns: repeat(4,1fr); }
.refined-position { box-shadow: 0 8px 24px rgba(31,42,55,.045); }
.position-metrics { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 18px 0 8px; color: var(--muted); font-size: 12px; }
.position-metrics b { color: #323942; }.positive { color: #3e8666 !important; }

.public-budget-card { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 24px; margin: 20px 0; border: 1px solid rgba(31,42,55,.06); border-radius: 22px; background: #fff; box-shadow: var(--shadow); }
.public-budget-card > div { display: flex; align-items: center; gap: 12px; }.public-budget-card form { display: flex; align-items: end; gap: 10px; }.public-budget-card label > span { display: block; color: var(--muted); font-size: 11px; }
.public-budget-card button { min-height: 42px; padding: 9px 14px; border: 0; border-radius: 11px; color: #fff; background: #334e68; cursor: pointer; }

.color-picker { padding: 0; border: 0; }
.color-picker legend { margin-bottom: 7px; color: var(--muted); font-size: 12px; }
.color-picker > div { display: flex; flex-wrap: wrap; gap: 9px; }
.color-picker label { position: relative; cursor: pointer; }
.color-picker input { position: absolute; opacity: 0; pointer-events: none; }
.color-picker span { display: block; width: 29px; height: 29px; border: 3px solid #fff; border-radius: 50%; box-shadow: 0 0 0 1px #d8dce1; transition: transform .16s ease, box-shadow .16s ease; }
.color-picker input:checked + span { transform: scale(1.13); box-shadow: 0 0 0 2px #fff, 0 0 0 4px #4e7398; }
.member-dot[data-color="#7487A3"], .member-avatar[data-color="#7487A3"], .color-picker span[data-color="#7487A3"] { background: #7487A3; }
.member-dot[data-color="#9B7E87"], .member-avatar[data-color="#9B7E87"], .color-picker span[data-color="#9B7E87"] { background: #9B7E87; }
.member-dot[data-color="#7C948B"], .member-avatar[data-color="#7C948B"], .color-picker span[data-color="#7C948B"] { background: #7C948B; }
.member-dot[data-color="#A98F6F"], .member-avatar[data-color="#A98F6F"], .color-picker span[data-color="#A98F6F"] { background: #A98F6F; }
.member-dot[data-color="#8B83A8"], .member-avatar[data-color="#8B83A8"], .color-picker span[data-color="#8B83A8"] { background: #8B83A8; }
.member-dot[data-color="#B07972"], .member-avatar[data-color="#B07972"], .color-picker span[data-color="#B07972"] { background: #B07972; }
.member-dot[data-color="#6F8F9B"], .member-avatar[data-color="#6F8F9B"], .color-picker span[data-color="#6F8F9B"] { background: #6F8F9B; }
.member-dot[data-color="#87936A"], .member-avatar[data-color="#87936A"], .color-picker span[data-color="#87936A"] { background: #87936A; }

@media (max-width: 900px) {
  .wealth-hero-v5 { grid-template-columns: 1fr; gap: 24px; }
  .hero-curve { height: 180px; }.hero-curve canvas { height: 150px !important; }
  .allocation-top { grid-template-columns: 1fr 240px; }
  .allocation-row-v5 { grid-template-columns: 140px minmax(0,1fr); }.allocation-result { grid-column: 2; justify-items: start; text-align: left; }
  .smart-entry-grid { grid-template-columns: 1fr; }
}
@media (max-width: 650px) {
  .container { width: min(100% - 28px, 1180px); }
  .intro-actions { align-items: stretch; flex-direction: column; }.refresh-all-button { width: 100%; }
  .wealth-hero-v5 { min-height: 0; padding: 30px 23px; }.v5-assets { margin-top: 10px; }
  .asset-manager-summary.four { grid-template-columns: repeat(2,1fr); }
  .allocation-top { grid-template-columns: 1fr; }.allocation-pie { height: 210px; }
  .allocation-row-v5 { grid-template-columns: 1fr; }.allocation-slider, .allocation-result { grid-column: 1 / -1; }.allocation-result { justify-items: start; text-align: left; }
  .public-budget-card { align-items: stretch; flex-direction: column; }.public-budget-card form { align-items: stretch; flex-direction: column; }
  .family-budget-overview > strong { font-size: 26px; }
}

/* ─── V6: household target, public spending and clarity fixes ─── */
.wealth-target { margin-top: 23px; padding-top: 18px; border-top: 1px solid rgba(255,255,255,.11); }
.wealth-target > div { display: flex; align-items: end; justify-content: space-between; gap: 18px; }
.wealth-target span small, .wealth-target span b { display: block; }
.wealth-target span small { color: rgba(255,255,255,.48); font-size: 10px; }
.wealth-target span b { margin-top: 3px; color: #fff; font-size: 15px; }
.wealth-target > div > strong { color: #dff5ed; font-size: 18px; }
.wealth-target progress { height: 8px; margin: 12px 0 7px; }
.wealth-target > p { display: flex; justify-content: space-between; gap: 12px; margin: 0; color: rgba(255,255,255,.5); font-size: 10px; }
.wealth-target-empty { margin-top: 22px; padding: 13px; color: rgba(255,255,255,.6); border: 1px dashed rgba(255,255,255,.18); border-radius: 12px; font-size: 12px; }
.wealth-target-settings { margin-top: 12px; }
.wealth-target-settings > summary { display: inline-flex; list-style: none; padding: 6px 10px; color: #a9cde3; border: 1px solid rgba(255,255,255,.12); border-radius: 999px; background: rgba(255,255,255,.06); cursor: pointer; font-size: 10px; }
.wealth-target-settings[open] { padding: 13px; color: var(--ink); border: 1px solid var(--line); border-radius: 14px; background: #fff; box-shadow: var(--shadow-hover); }
.wealth-target-settings[open] > summary { margin-bottom: 10px; color: #334e68; border-color: #dce4eb; background: #edf3f7; }
.wealth-target-settings[open] label { color: #49494d; }

.public-avatar, .public-dot { color: #fff; background: #90959c; }
.public-dot { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; font-size: 10px; font-weight: 700; }
.separate-budgets { display: grid; grid-template-columns: 1.05fr .95fr; gap: 16px; }
.separate-budgets .budget-panel { margin: 16px 0; }
.public-budget-progress-list { display: grid; gap: 17px; margin-top: 22px; }
.public-budget-progress-list > div > div { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px; }
.public-budget-progress-list progress { width: 100%; height: 8px; margin: 8px 0 3px; overflow: hidden; border: 0; border-radius: 99px; }
.public-budget-progress-list progress::-webkit-progress-bar { background: #eceef0; }.public-budget-progress-list progress::-webkit-progress-value { border-radius: 99px; background: #8f929a; }
.public-budget-progress-list small { color: var(--muted); }

.percent-control {
  display: grid !important; grid-template-columns: minmax(0,1fr) auto !important;
  align-items: center; min-width: 78px; min-height: 42px; padding: 4px 7px !important;
  color: #17212b !important; border: 1px solid #cbd3db !important;
  border-radius: 10px; background: #fff !important; box-shadow: 0 2px 7px rgba(31,42,55,.06);
}
.percent-control input, .allocation-row-v5 [data-percent-number] {
  display: block !important; width: 46px !important; min-width: 46px !important;
  min-height: 30px !important; padding: 2px 0 !important; color: #17212b !important;
  border: 0 !important; opacity: 1 !important; background: #fff !important;
  font-size: 15px !important; font-weight: 800; line-height: 1 !important;
  text-align: right; -webkit-text-fill-color: #17212b !important;
}
.percent-control span { color: #4f5e6d; font-weight: 700; }
.allocation-row-v5 input[type="range"] { min-width: 100px; }

.insight-grid { display: grid; grid-template-columns: .9fr 1.1fr; gap: 16px; margin-bottom: 16px; }
.insight-grid .analysis-card { min-width: 0; border-radius: 24px; }
.insight-grid .chart-wrap { height: 300px; }
.category-analysis-card { margin-bottom: 16px; border-radius: 24px; }
.spending-chart-head { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.spending-owner-switch { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.spending-owner-switch button { min-height: 31px; padding: 5px 10px; color: #66717c; border-color: #dce1e6; border-radius: 999px; background: #f6f7f8; font-size: 10px; }
.spending-owner-switch button.active { color: #fff; border-color: #405f79; background: #405f79; }
.spending-pie-wrap { position: relative; height: 360px; }
.spending-pie-wrap canvas { width: 100% !important; height: 100% !important; }
.spending-empty { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; color: var(--muted); font-size: 12px; }
.spending-total { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-top: 8px; padding: 14px 16px; border: 1px solid #e4e7ea; border-radius: 14px; background: #f8f9fa; }
.spending-total span { color: var(--muted); font-size: 12px; }
.spending-total strong { color: #26333f; font-size: 20px; }

.public-budget-manager { margin: 24px 0 44px; scroll-margin-top: 80px; }
.public-manager-grid { display: grid; grid-template-columns: 330px 1fr; gap: 18px; margin-top: 14px; }
.public-manager-grid > .panel { align-self: start; }
.public-plan-row { grid-template-columns: auto 1fr auto auto; }
.public-plan-row > details { position: relative; }.public-plan-row > details > summary { color: #4f7192; cursor: pointer; font-size: 12px; }
.public-plan-row > details[open] { padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: #fff; box-shadow: var(--shadow-hover); }
.budget-member-section { padding-top: 30px; border-top: 1px solid #dde1e6; }
.rollover-switch { display: flex; align-items: flex-start; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 13px; background: #f7f9fa; cursor: pointer; }
.rollover-switch input { width: 18px; min-height: 18px; margin-top: 2px; accent-color: #4f7f69; }
.rollover-switch span, .rollover-switch b, .rollover-switch small { display: block; }
.rollover-switch small { margin-top: 3px; color: var(--muted); font-size: 10px; font-weight: 400; line-height: 1.5; }
.budget-row-actions { display: flex; align-items: center; gap: 7px; }
.budget-row-actions form { margin: 0; }
.rollover-toggle { min-height: 32px; padding: 5px 9px; color: #69737d; border-color: #d5dadd; background: #f7f8f9; font-size: 10px; }
.rollover-toggle.active { color: #32644f; border-color: #b9d3c7; background: #eaf4ef; }

@media (max-width: 900px) {
  .separate-budgets, .insight-grid { grid-template-columns: 1fr; }
  .public-manager-grid { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .wealth-target > p { align-items: flex-start; flex-direction: column; }
  .spending-chart-head { align-items: stretch; flex-direction: column; }
  .spending-owner-switch { justify-content: flex-start; }
  .spending-pie-wrap { height: 330px; }
  .public-plan-row { grid-template-columns: auto 1fr auto; }.public-plan-row > details { grid-column: 2 / -1; }
  .member-budget-row { grid-template-columns: auto 1fr auto; }.budget-row-actions { grid-column: 2 / -1; }
}

/* ─── V7: searchable bills and accountable investment trades ─── */
.list-subtitle { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.bill-filter-panel {
  margin-bottom: 12px; padding: 17px;
  border: 1px solid #dde3e8; border-radius: 20px;
  background: linear-gradient(135deg, #fff 0%, #f7fafc 100%);
  box-shadow: 0 8px 24px rgba(41,55,69,.045);
}
.bill-filter-form {
  display: grid; grid-template-columns: minmax(210px,1.7fr) repeat(5,minmax(115px,1fr)) auto;
  gap: 10px; align-items: end;
}
.bill-filter-form label, .merchant-rule-form label {
  display: grid; gap: 5px; color: #68737e; font-size: 10px; font-weight: 650;
}
.bill-filter-form input, .bill-filter-form select,
.merchant-rule-form input, .merchant-rule-form select {
  width: 100%; min-width: 0; min-height: 39px; background: #fff;
}
.filter-actions { display: flex; align-items: center; gap: 9px; min-height: 39px; }
.filter-actions .primary-button { min-height: 39px; padding: 8px 15px; }
.filter-actions a { color: #65788a; font-size: 11px; white-space: nowrap; }
.filter-result { margin: 11px 0 0; color: #71808d; font-size: 11px; }

.merchant-rule-panel {
  margin-bottom: 12px; border: 1px solid #e0e4e8; border-radius: 17px; background: #fff;
}
.merchant-rule-panel > summary {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 17px; cursor: pointer; list-style: none;
}
.merchant-rule-panel > summary span { color: #43576a; font-size: 13px; font-weight: 720; }
.merchant-rule-panel > summary small { color: var(--muted); font-size: 10px; }
.merchant-rule-panel[open] > summary { border-bottom: 1px solid #edf0f2; }
.merchant-rule-content { padding: 16px; }
.merchant-rule-form { display: grid; grid-template-columns: 1fr 1fr auto; gap: 10px; align-items: end; }
.merchant-rule-form button { min-height: 39px; }
.merchant-rule-list { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; margin-top: 14px; }
.merchant-rule-list > div {
  display: flex; align-items: center; gap: 8px; min-width: 0; padding: 10px 12px;
  border: 1px solid #e8ebee; border-radius: 12px; background: #fafbfc;
}
.merchant-rule-list > div > span { min-width: 0; margin-right: auto; color: #44525f; font-size: 11px; }
.merchant-rule-list em { margin: 0 7px; color: #9aa4ad; font-style: normal; }
.merchant-rule-list small { color: var(--muted); font-size: 9px; white-space: nowrap; }
.merchant-rule-list form { margin: 0; }.merchant-rule-list button { padding: 3px 5px; font-size: 9px; }

.batch-toolbar {
  position: sticky; top: 8px; z-index: 15;
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  margin: 0 0 10px; padding: 10px 13px;
  border: 1px solid rgba(196,207,216,.9); border-radius: 15px;
  background: rgba(255,255,255,.92); box-shadow: 0 10px 28px rgba(35,48,61,.09);
  backdrop-filter: blur(16px);
}
.batch-toolbar .select-all { display: flex; align-items: center; gap: 6px; color: #42566a; font-size: 11px; font-weight: 650; }
.batch-toolbar input[type="checkbox"], .bill-checkbox { width: 16px; min-height: 16px; accent-color: #4f7a9b; }
.batch-toolbar > span { margin-right: auto; color: var(--muted); font-size: 10px; }
.batch-toolbar select, .batch-toolbar input:not([type="hidden"]):not([type="checkbox"]) { width: auto; min-width: 130px; min-height: 34px; padding: 6px 9px; font-size: 10px; }
.batch-toolbar [data-batch-field] { display: none; }
.batch-toolbar button { min-height: 34px; padding: 6px 13px; }

.enhanced-bills .bill-row { grid-template-columns: auto auto 1fr auto auto; }
.bill-checkbox { opacity: .58; transition: opacity .18s ease, transform .18s ease; }
.bill-row:hover .bill-checkbox, .bill-checkbox:checked { opacity: 1; transform: scale(1.08); }
.bill-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 5px; }
.bill-tags a { padding: 2px 7px; color: #52718d; border-radius: 999px; background: #edf3f7; font-size: 9px; }

.cash-link-box {
  display: grid; gap: 8px; padding: 11px;
  border: 1px solid #dbe6df; border-radius: 12px; background: #f4f9f6;
}
.cash-link-box .check-line { display: flex; grid-template-columns: none; align-items: center; gap: 8px; color: #315d49; font-size: 11px; font-weight: 700; cursor: pointer; }
.cash-link-box .check-line input { width: 17px; min-height: 17px; accent-color: #4f846b; }
.cash-link-box > small { color: #74837b; font-size: 9px; line-height: 1.5; }
.cash-link-box.cash-disabled { opacity: .62; border-color: #e1e4e6; background: #f6f7f8; }
.trade-history .trade-history-row { grid-template-columns: auto 1fr auto auto; }
.trade-record-actions { position: relative; }
.trade-record-actions > summary { padding: 5px 8px; color: #526f89; border: 1px solid #dfe5ea; border-radius: 8px; background: #fff; cursor: pointer; font-size: 9px; list-style: none; }
.trade-record-actions[open] { grid-column: 1 / -1; padding: 10px 0 3px; }
.trade-record-actions[open] > summary { display: inline-block; margin-bottom: 8px; }
.trade-record-actions > div { display: grid; gap: 8px; }
.trade-record-actions .confirm-delete { margin: 0; text-align: right; }
.trade-record-actions .danger-link { padding: 5px 7px; font-size: 9px; }

@media (max-width: 1050px) {
  .bill-filter-form { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .filter-search { grid-column: span 2; }
}
@media (max-width: 650px) {
  .bill-filter-panel { padding: 13px; border-radius: 16px; }
  .bill-filter-form { grid-template-columns: 1fr 1fr; }
  .filter-search { grid-column: 1 / -1; }
  .filter-actions { grid-column: 1 / -1; }
  .merchant-rule-form, .merchant-rule-list { grid-template-columns: 1fr; }
  .merchant-rule-panel > summary { align-items: flex-start; flex-direction: column; }
  .batch-toolbar { top: 5px; }
  .batch-toolbar > span { margin-right: 0; }
  .batch-toolbar select, .batch-toolbar input:not([type="hidden"]):not([type="checkbox"]) { flex: 1; min-width: 120px; }
  .enhanced-bills .bill-row { grid-template-columns: auto auto 1fr auto; padding: 8px 2px; }
  .enhanced-bills .bill-amount { grid-column: 3; grid-row: 2; min-width: 0; text-align: left; font-size: 12px; }
  .enhanced-bills .bill-menu { grid-column: 4; grid-row: 1 / span 2; }
  .trade-history .trade-history-row { grid-template-columns: auto 1fr auto; }
  .trade-history .trade-history-row > div:nth-of-type(2) { grid-column: 2 / -1; text-align: left; }
  .trade-record-actions { grid-column: 3; grid-row: 1; }
}
