/* ==========================================================================
   DreamFundSL — Dashboard (.dx-*)
   Standard system fonts only (no web fonts), theme-aware: every colour comes
   from the tokens in app.css, so light and dark both work. Everything is
   scoped under .dx so nothing here leaks into other pages.
   ========================================================================== */

.dx {
  --dx-gap: 16px;
  --dx-radius: 14px;
  --dx-save: var(--blue);          /* savings accent used across the dashboard */
  --dx-save-dim: var(--blue-dim);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text-primary);
  max-width: 1320px;
}
.dx [hidden] { display: none !important; }
.dx h1, .dx h2, .dx h3, .dx p, .dx dl, .dx dd, .dx ul { margin: 0; padding: 0; }
.dx ul { list-style: none; }
.dx .num { font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.dx .is-pos { color: var(--green); }
.dx .is-neg { color: var(--coral); }
.dx .is-save { color: var(--dx-save); }

/* ---------- Header ---------- */
.dx-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.dx-eyebrow { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 6px; }
.dx-title { font-size: 28px; line-height: 1.15; font-weight: 700; letter-spacing: -0.02em; color: var(--text-strong); }
.dx-lede { margin-top: 6px; font-size: 14px; color: var(--text-muted); }
.dx-meta { text-align: right; }
.dx-date { font-size: 13px; font-weight: 500; color: var(--text-muted); }
.dx-clock { font-size: 22px; font-weight: 600; color: var(--text-strong); font-variant-numeric: tabular-nums; line-height: 1.25; }

/* ---------- Cards & grid ---------- */
.dx-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--dx-gap); margin-bottom: var(--dx-gap); align-items: start; }
.dx-span-3 { grid-column: span 3; } .dx-span-4 { grid-column: span 4; } .dx-span-5 { grid-column: span 5; }
.dx-span-6 { grid-column: span 6; } .dx-span-7 { grid-column: span 7; } .dx-span-12 { grid-column: span 12; }

.dx-card {
  background: var(--bg-raised); border: 1px solid var(--line); border-radius: var(--dx-radius);
  box-shadow: var(--shadow-card, var(--shadow-sm)); padding: 20px; min-width: 0;
  display: flex; flex-direction: column;
}
.dx-card-flush { padding: 20px 0 0; }
.dx-card-flush > .dx-card-head { padding: 0 20px; }
.dx-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; min-height: 22px; }
.dx-card-title { font-size: 13px; font-weight: 600; color: var(--text-muted); letter-spacing: .01em; display: flex; align-items: center; gap: 8px; }
.dx-card-title svg { width: 15px; height: 15px; }
.dx-note { font-size: 12px; color: var(--text-faint); }
.dx-link { display: inline-flex; align-items: center; gap: 2px; background: none; border: 0; padding: 0; font: inherit; font-size: 12.5px; font-weight: 600; color: var(--teal-ink, var(--teal)); cursor: pointer; white-space: nowrap; }
.dx-link svg { width: 13px; height: 13px; }
.dx-link:hover { text-decoration: underline; }
.dx :focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; border-radius: 6px; }

.dx-big { font-size: 28px; line-height: 1.15; font-weight: 700; letter-spacing: -0.02em; color: var(--text-strong); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.dx-sub { margin-top: 6px; font-size: 12.5px; line-height: 1.5; color: var(--text-muted); }
.dx-empty { padding: 8px 0; font-size: 13px; line-height: 1.5; color: var(--text-muted); }
.dx-more { margin-top: 8px; font-size: 12px; color: var(--text-faint); }
.dx-foot { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--text-muted); }
.dx-foot strong { color: var(--text-strong); font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.dx-btn { align-self: flex-start; margin-top: 10px; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--bg-raised); color: var(--text-strong); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.dx-btn:hover { background: var(--bg-hover); }

/* ---------- Progress bars ---------- */
.dx-track { height: 6px; border-radius: 999px; background: var(--parchment-dim); overflow: hidden; }
.dx-track-lg { height: 8px; }
.dx-fill { display: block; height: 100%; border-radius: inherit; background: var(--teal); transition: width .5s ease; min-width: 0; }
.dx-fill.is-ok { background: var(--green); } .dx-fill.is-warn { background: var(--gold); } .dx-fill.is-over { background: var(--coral); }
.dx-fill.is-save { background: var(--dx-save); }
.dx-fill.is-in { background: var(--teal); } .dx-fill.is-out { background: var(--coral); }

/* ---------- KPI strip ---------- */
.dx-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--dx-gap); margin-bottom: var(--dx-gap); }
.dx-kpi { background: var(--bg-raised); border: 1px solid var(--line); border-radius: var(--dx-radius); box-shadow: var(--shadow-card, var(--shadow-sm)); padding: 18px 20px; display: flex; flex-direction: column; gap: 4px; min-width: 0; text-align: left; font: inherit; color: inherit; position: relative; }
button.dx-kpi { cursor: pointer; transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease; }
button.dx-kpi:hover { border-color: var(--line-strong); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.dx-kpi-top { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.dx-kpi-icon { width: 30px; height: 30px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; background: var(--teal-dim); color: var(--teal); flex: none; }
.dx-kpi-icon svg { width: 16px; height: 16px; }
.dx-kpi-icon.t-save { background: var(--dx-save-dim); color: var(--dx-save); }
.dx-kpi-icon.t-green { background: var(--green-dim); color: var(--green); }
.dx-kpi-icon.t-gold { background: var(--gold-dim); color: var(--gold); }
.dx-kpi-label { font-size: 13px; font-weight: 600; color: var(--text-muted); }
.dx-kpi-go { margin-left: auto; color: var(--text-faint); display: inline-flex; }
.dx-kpi-go svg { width: 14px; height: 14px; }
.dx-kpi-value { font-size: 24px; line-height: 1.2; font-weight: 700; letter-spacing: -0.02em; color: var(--text-strong); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.dx-kpi-note { font-size: 12.5px; color: var(--text-muted); line-height: 1.45; }
.dx-kpi-note b { font-weight: 600; }
.dx-kpi.is-hero { background: linear-gradient(150deg, #0a4a5e 0%, var(--ink-800) 45%, var(--ink-900) 100%); border-color: transparent; color: #fff; }
.dx-kpi.is-hero .dx-kpi-label, .dx-kpi.is-hero .dx-kpi-note { color: rgba(255,255,255,.72); }
.dx-kpi.is-hero .dx-kpi-value { color: #fff; }
.dx-kpi.is-hero .dx-kpi-icon { background: rgba(255,255,255,.14); color: #fff; }
.dx-kpi.is-loading .dx-skel { height: 28px; }

.dx-skel { display: block; border-radius: 6px; background: var(--bg-stripe); animation: dx-pulse 1.4s ease-in-out infinite; }
.dx-skel.sm { height: 12px; width: 60%; margin-top: 8px; }
@keyframes dx-pulse { 0%,100% { opacity: .55; } 50% { opacity: 1; } }

/* stacked allocation bar (used in hero card and "Where the money is") */
.dx-alloc { display: flex; gap: 2px; height: 8px; border-radius: 999px; overflow: hidden; background: rgba(127,127,127,.18); margin-top: 10px; }
.dx-alloc.on-card { height: 10px; background: var(--parchment-dim); margin: 0 0 16px; }
.dx-alloc-seg { display: block; height: 100%; min-width: 4px; transition: width .5s ease; }
.seg-bank { background: #3fc1dc; } .seg-cash { background: #9db7ee; } .seg-sav { background: var(--dx-save); } .seg-inv { background: var(--violet); }
.dx-kpi.is-hero .seg-sav { background: #7fa6f2; } .dx-kpi.is-hero .seg-inv { background: #b79bec; }
.dx-key { display: inline-block; width: 10px; height: 10px; border-radius: 3px; flex: none; }

/* ---------- Savings panel ---------- */
.dx-sav-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 16px 0 6px; }
.dx-stat { background: var(--parchment); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; min-width: 0; }
.dx-stat dt { font-size: 11.5px; font-weight: 600; color: var(--text-muted); }
.dx-stat dd { margin-top: 3px; font-size: 15px; font-weight: 700; color: var(--text-strong); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.dx-sav-list { display: flex; flex-direction: column; gap: 14px; margin-top: 14px; }
.dx-sav-row-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 6px; font-size: 13px; }
.dx-sav-name { font-weight: 600; color: var(--text-strong); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.dx-sav-fig { font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.dx-sav-fig b { color: var(--text-strong); font-weight: 600; }
.dx-sav-tag { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 999px; font-size: 10.5px; font-weight: 600; background: var(--parchment-dim); color: var(--text-muted); vertical-align: 1px; }

/* ---------- Cash-flow chart ---------- */
.dx-flow-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 12px; }
.dx-flow-stat { min-width: 0; }
.dx-flow-stat span { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--text-muted); }
.dx-flow-stat strong { display: block; margin-top: 2px; font-size: 18px; font-weight: 700; color: var(--text-strong); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.dx-chart { width: 100%; }
.dx-chart svg { display: block; width: 100%; height: auto; }
.dx-chart .grid { stroke: var(--line); stroke-width: 1; }
.dx-chart .axis { fill: var(--text-faint); font-size: 10.5px; }
.dx-chart .mlabel { fill: var(--text-muted); font-size: 11px; }
.dx-chart .grp { cursor: pointer; }
.dx-chart .grp .hit { fill: transparent; }
.dx-chart .grp:hover .hit, .dx-chart .grp.is-active .hit { fill: var(--bg-hover); }
.dx-chart .bar-in { fill: var(--teal); } .dx-chart .bar-out { fill: var(--coral); } .dx-chart .bar-sav { fill: var(--dx-save); }
.dx-legend { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 8px; font-size: 12px; color: var(--text-muted); }
.dx-legend span { display: inline-flex; align-items: center; gap: 6px; }
.dx-readout { margin-top: 10px; padding: 10px 12px; border-radius: 10px; background: var(--parchment); border: 1px solid var(--line); font-size: 12.5px; color: var(--text-muted); display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: baseline; }
.dx-readout b { color: var(--text-strong); font-weight: 600; }
.dx-readout .m { font-weight: 700; color: var(--text-strong); }

/* ---------- Insight cards: budget, health, bills ---------- */
.dx-list { display: flex; flex-direction: column; gap: 12px; margin-top: 14px; }
.dx-list-top { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 5px; font-size: 12.5px; }
.dx-list-name { font-weight: 600; color: var(--text-strong); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dx-list-fig { color: var(--text-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }

.dx-health { cursor: pointer; }
.dx-health:hover { border-color: var(--line-strong); }
.dx-ring-wrap { display: flex; align-items: center; gap: 16px; }
.dx-ring { position: relative; width: 96px; height: 96px; flex: none; }
.dx-ring svg { width: 100%; height: 100%; }
.dx-ring-track { fill: none; stroke: var(--parchment-dim); stroke-width: 9; }
.dx-ring-value { fill: none; stroke: var(--teal); stroke-width: 9; stroke-linecap: round; transition: stroke-dasharray .6s ease; }
.dx-ring.excellent .dx-ring-value, .dx-ring.very-healthy .dx-ring-value { stroke: var(--green); }
.dx-ring.healthy .dx-ring-value { stroke: var(--gold); }
.dx-ring.needs-attention .dx-ring-value, .dx-ring.at-risk .dx-ring-value, .dx-ring.critical .dx-ring-value { stroke: var(--coral); }
.dx-ring.unset .dx-ring-value { stroke: var(--text-faint); }
.dx-ring-text { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.dx-ring-text strong { font-size: 26px; line-height: 1; font-weight: 700; color: var(--text-strong); }
.dx-ring-text span { font-size: 10.5px; color: var(--text-muted); margin-top: 2px; }
.dx-health-meta { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; min-width: 0; }

.dx-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.dx-health-head { display: flex; align-items: center; gap: 14px; padding: 10px 16px 10px 12px; text-align: left; font: inherit; color: inherit; background: var(--card, var(--surface, #fff)); border: 1px solid var(--line); border-radius: 14px; max-width: 360px; }
.dx-health-head.is-loading { min-width: 220px; min-height: 64px; }
.dx-health-head .dx-ring { width: 64px; height: 64px; }
.dx-health-head .dx-ring-text strong { font-size: 19px; }
.dx-health-label { font-size: 11.5px; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; color: var(--text-muted); }
.dx-health-level { font-size: 15px; font-weight: 700; color: var(--text-strong); }
.dx-health-tip { font-size: 12px; line-height: 1.4; color: var(--text-muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.dx-health-delta { font-size: 11px; font-weight: 700; margin-left: 4px; } .dx-health-delta.is-pos { color: var(--green); } .dx-health-delta.is-neg { color: var(--coral); }

.dx-bills { display: flex; flex-direction: column; margin-top: 12px; }
.dx-bill { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); }
.dx-bill:first-child { border-top: 0; }
.dx-bill-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-faint); flex: none; }
.dx-bill.is-soon .dx-bill-dot { background: var(--gold); } .dx-bill.is-overdue .dx-bill-dot { background: var(--coral); }
.dx-bill-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.dx-bill-name { font-size: 13px; font-weight: 600; color: var(--text-strong); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dx-bill-due { font-size: 12px; color: var(--text-muted); }
.dx-bill.is-overdue .dx-bill-due { color: var(--coral); }
.dx-bill-amt { font-size: 13px; font-weight: 600; color: var(--text-strong); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- Attention & tasks ---------- */
.dx-two { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: var(--dx-gap); margin-bottom: var(--dx-gap); align-items: start; }
.dx-two > .dx-card { margin: 0; }
.dx .attention-list { display: flex; flex-direction: column; gap: 8px; }
.dx .attention-row { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border-radius: 10px; background: var(--parchment); border: 1px solid var(--line); font-size: 13px; line-height: 1.45; }
.dx .attention-clickable { cursor: pointer; }
.dx .attention-clickable:hover { border-color: var(--line-strong); background: var(--bg-hover); }
.dx .attention-icon { flex: none; width: 20px; height: 20px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; background: var(--teal-dim); color: var(--teal); }
.dx .attention-warning .attention-icon { background: var(--gold-dim); color: var(--gold); }
.dx .attention-positive .attention-icon { background: var(--green-dim); color: var(--green); }
.dx .all-clear { display: flex; align-items: center; gap: 12px; font-size: 14px; }
.dx .all-clear-mark { width: 32px; height: 32px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--green-dim); color: var(--green); font-weight: 700; }

/* ---------- Where the money is ---------- */
.dx-buckets { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 1100px) { .dx-buckets { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.dx-bucket { background: var(--parchment); border: 1px solid var(--line); border-radius: 12px; padding: 14px; text-align: left; font: inherit; color: inherit; cursor: pointer; min-width: 0; transition: border-color .15s ease; }
.dx-bucket:hover { border-color: var(--line-strong); }
.dx-bucket-top { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 600; color: var(--text-muted); margin-bottom: 6px; }
.dx-bucket-val { font-size: 18px; font-weight: 700; color: var(--text-strong); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.dx-bucket-note { margin-top: 3px; font-size: 12px; color: var(--text-muted); line-height: 1.4; }
.dx .cash-box-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; margin-top: 12px; }
.dx .cash-box { background: var(--parchment); border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
.dx .cash-box.is-you { border-color: var(--teal); }
.dx .cash-box-name { font-size: 13px; font-weight: 600; color: var(--text-strong); display: flex; align-items: center; gap: 6px; }
.dx .cash-box-you-pill { font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 999px; background: var(--teal-dim); color: var(--teal); }
.dx .cash-box-amount { margin: 4px 0 8px; font-size: 16px; font-weight: 700; color: var(--text-strong); font-variant-numeric: tabular-nums; }
.dx .cash-box-actions { display: flex; gap: 6px; }
.dx .cash-box-actions .stat-edit { padding: 4px 10px; border-radius: 6px; border: 1px solid var(--line-strong); background: var(--bg-raised); color: var(--text-primary); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; }

/* ---------- Recent transactions ---------- */
.dx-chips { display: inline-flex; gap: 4px; padding: 3px; border-radius: 10px; background: var(--parchment-dim); }
.dx-chip { border: 0; background: transparent; color: var(--text-muted); font: inherit; font-size: 12.5px; font-weight: 600; padding: 5px 12px; border-radius: 8px; cursor: pointer; }
.dx-chip.is-active { background: var(--bg-raised); color: var(--text-strong); box-shadow: var(--shadow-sm); }
.dx-table-scroll { overflow-x: auto; }
.dx-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.dx-table th { text-align: left; padding: 10px 14px; font-size: 11.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--text-muted); border-bottom: 1px solid var(--line); border-top: 1px solid var(--line); background: var(--bg-stripe); white-space: nowrap; }
.dx-table td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.dx-table th:first-child, .dx-table td:first-child { padding-left: 20px; }
.dx-table th:last-child, .dx-table td:last-child { padding-right: 20px; }
.dx-table tbody tr:last-child td { border-bottom: 0; }
.dx-table tbody tr:hover td { background: var(--bg-hover); }
.dx-table .amt { text-align: right; font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.dx-table .amt.t-income { color: var(--green); } .dx-table .amt.t-expense { color: var(--coral); } .dx-table .amt.t-savings { color: var(--dx-save); }
.dx-table code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; background: var(--parchment-dim); padding: 1px 6px; border-radius: 5px; }
.dx .type-pill.savings { background: var(--dx-save-dim); color: var(--dx-save); }
.dx-viewbtn { display: inline-flex; align-items: center; gap: 2px; border: 0; background: none; font: inherit; font-size: 12.5px; font-weight: 600; color: var(--teal-ink, var(--teal)); cursor: pointer; padding: 0; }
.dx-viewbtn svg { width: 13px; height: 13px; }
.dx-card .empty-state { padding: 18px 20px; font-size: 13px; color: var(--text-muted); }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .dx-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dx-span-3, .dx-span-4, .dx-span-5, .dx-span-6, .dx-span-7 { grid-column: span 12; }
}
@media (max-width: 800px) {
  .dx-title { font-size: 24px; }
  .dx-clock { display: none; }
  .dx-meta { text-align: left; align-items: stretch; width: 100%; }
  .dx-health-head { max-width: none; }
  .dx-card { padding: 16px; border-radius: 12px; }
  .dx-card-flush { padding: 16px 0 0; } .dx-card-flush > .dx-card-head { padding: 0 16px; }
  .dx-kpis { gap: 10px; } .dx-kpi { padding: 14px; } .dx-kpi-value { font-size: 19px; }
  .dx-kpi.is-hero { grid-column: span 2; }
  .dx-big { font-size: 24px; }
  .dx-sav-stats, .dx-flow-stats { gap: 8px; }
  .dx-flow-stat strong { font-size: 15px; }
  .dx-two { grid-template-columns: minmax(0, 1fr); }
  .dx-table .hide-sm { display: none; }
  .dx-table th:first-child, .dx-table td:first-child { padding-left: 16px; }
  .dx-table th:last-child, .dx-table td:last-child { padding-right: 16px; }
  .dx-table tbody tr { cursor: pointer; }
}
@media (max-width: 420px) {
  .dx-buckets { grid-template-columns: minmax(0, 1fr); }
  .dx-sav-stats { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .dx-sav-stats .dx-stat:last-child { grid-column: span 2; }
}
@media (prefers-reduced-motion: reduce) {
  .dx * { transition: none !important; animation: none !important; }
}


/* Layout: two equal-height columns, then rows whose cards stretch to the same
   height, so no card is ever left with an empty hole beside or under it. */
.dx-cols { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: var(--dx-gap); margin-bottom: var(--dx-gap); align-items: stretch; }
.dx-col { display: flex; flex-direction: column; gap: var(--dx-gap); min-width: 0; }
.dx-col > .dx-card:last-child { flex: 1; }
.dx-grid.dx-stretch, .dx-two { align-items: stretch; }
/* Today's tasks ships its own nested card; flatten it so there is no double border. */
.dx .dt-dash.card { border: 0; box-shadow: none; background: transparent; padding: 0; }
@media (max-width: 1100px) {
  .dx-cols { display: flex; flex-direction: column; }
  .dx-col { display: contents; }
  .dx-o1 { order: 1; } .dx-o2 { order: 2; } .dx-o3 { order: 3; } .dx-o4 { order: 4; }
}

/* ---- Safe to spend today (public/js/pages/safeToday.js) ---- */
.dx-sts { margin-bottom: var(--dx-gap); }
.dx .is-warn { color: var(--gold, #b7791f); }
.dx-sts-top { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px 28px; }
.dx-sts-stats { display: flex; flex-wrap: wrap; gap: 8px 28px; margin: 0; }
.dx-sts-stats dt { font-size: 12px; color: var(--text-muted); }
.dx-sts-stats dd { margin: 2px 0 0; font-size: 16px; font-weight: 650; color: var(--text-strong); font-variant-numeric: tabular-nums; }
.dx-sts-how { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.dx-sts-how > summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--teal-ink, var(--teal)); list-style-position: inside; }
.dx-sts-explain { margin: 12px 0 14px; padding-left: 20px; font-size: 13px; line-height: 1.6; color: var(--text); }
.dx-sts-explain li + li { margin-top: 4px; }
.dx-sts-lines { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.dx-sts-line { padding: 10px 14px; }
.dx-sts-line + .dx-sts-line { border-top: 1px solid var(--line); }
.dx-sts-line-top { display: flex; justify-content: space-between; gap: 12px; font-size: 13.5px; color: var(--text-strong); }
.dx-sts-line-top b { font-variant-numeric: tabular-nums; white-space: nowrap; }
.dx-sts-line p { margin: 3px 0 0; font-size: 12px; line-height: 1.5; color: var(--text-muted); }
.dx-sts-line.is-subtotal, .dx-sts-line.is-result { background: var(--parchment-dim, rgba(127,127,127,.08)); }
.dx-sts-line.is-subtotal .dx-sts-line-top, .dx-sts-line.is-result .dx-sts-line-top { font-weight: 700; }
.dx-sts-notes { margin-top: 14px; font-size: 12.5px; line-height: 1.55; color: var(--text-muted); }
.dx-sts-notes ul { margin: 6px 0 0; padding-left: 18px; }
.dx-sts-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px 24px; margin-top: 16px; }
.dx-sts-cols:empty { display: none; }
.dx-sts-h { margin: 0 0 6px; font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: none; letter-spacing: .01em; }
.dx-sts-list { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.dx-sts-list li { display: flex; justify-content: space-between; gap: 10px; padding: 5px 0; border-bottom: 1px dashed var(--line); }
.dx-sts-list li:last-child { border-bottom: 0; }
.dx-sts-list em { display: block; font-style: normal; font-size: 11.5px; color: var(--text-faint); }
.dx-sts-list b { font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 600; }

/* ---------- Recent activity: transaction icons ---------- */
.dx-txn { display: flex; align-items: center; gap: 12px; min-width: 0; }
.dx-ticon { width: 34px; height: 34px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; flex: none; background: var(--blue-dim); color: var(--blue); }
.dx-ticon svg { width: 17px; height: 17px; }
.dx-ticon.is-income { background: var(--green-dim); color: var(--green); }
.dx-ticon.is-expense { background: var(--coral-dim); color: var(--coral); }
.dx-ticon.is-savings { background: var(--dx-save-dim); color: var(--dx-save); }
.dx-ticon.is-lending { background: var(--gold-dim); color: var(--gold); }
.dx-ticon.is-banking { background: var(--blue-dim); color: var(--blue); }
.dx-txn-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.dx-txn-name { font-weight: 600; color: var(--text-strong); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 320px; }
.dx-txn-type { font-size: 12px; color: var(--text-muted); }
@media (max-width: 800px) { .dx-txn-name { max-width: 46vw; } }

/* ---------- Tier headings ---------- */
.dx-tier { display: flex; align-items: baseline; gap: 10px; margin: 28px 0 12px; padding-bottom: 8px; border-bottom: 1px solid var(--border, rgba(128,128,128,.25)); }
.dx-tier:first-of-type { margin-top: 8px; }
.dx-tier-title { margin: 0; font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.dx-tier-sub { font-size: 12.5px; opacity: .65; }


/* ---------- Phone: recent transactions fit the screen, no sideways scroll ---------- */
@media (max-width: 800px) {
  .dx-table-scroll { overflow-x: visible; }
  .dx-recent .dx-table { table-layout: fixed; width: 100%; }
  .dx-recent .dx-table th:nth-child(1), .dx-recent .dx-table td:nth-child(1) { width: 62px; padding-right: 4px; white-space: normal; line-height: 1.25; font-size: 12px; color: var(--text-muted); }
  .dx-recent .dx-table th:nth-child(6), .dx-recent .dx-table td:nth-child(6) { width: 104px; padding-left: 6px; font-size: 13px; }
  .dx-recent .dx-table td:nth-child(2) { padding-left: 8px; padding-right: 6px; overflow: hidden; }
  .dx-recent .dx-txn { gap: 8px; }
  .dx-recent .dx-ticon { width: 30px; height: 30px; }
  .dx-recent .dx-txn-name { max-width: 100%; }
  .dx-recent .dx-txn-text { flex: 1 1 auto; }
  .dx-recent .dx-card-head { flex-wrap: wrap; gap: 8px; }
  .dx-recent .dx-chips { max-width: 100%; overflow: hidden; }
  .dx-recent .dx-chip { padding: 5px 9px; }
}

/* ---------- Currency Converter ---------- */
.cc-input { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 18px; }
.cc-field { display: flex; flex-direction: column; gap: 6px; flex: 1 1 200px; font-size: 12.5px; font-weight: 600; color: var(--text-muted); }
.cc-field input, .cc-field select { font: inherit; font-size: 16px; font-weight: 600; color: var(--text-strong); padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: transparent; min-width: 0; }
.cc-results { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.cc-result { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 14px; text-align: left; font: inherit; color: inherit; background: transparent; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; }
.cc-result:hover { border-color: var(--line-strong); }
.cc-result-code { font-size: 12px; font-weight: 700; letter-spacing: .04em; color: var(--text-muted); }
.cc-result-name { font-size: 12px; color: var(--text-muted); }
.cc-result-val { margin-top: 6px; font-size: 20px; font-weight: 700; color: var(--text-strong); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.cc-source { margin: 14px 0 0; }
.cc-rates-title { margin-top: 22px; }
.cc-rates { list-style: none; margin: 8px 0 0; padding: 0; }
.cc-rates li { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-top: 1px solid var(--line); font-size: 13.5px; }
.cc-rates li:first-child { border-top: 0; }
.cc-toggles { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 16px; }
.cc-toggles-label { font-size: 12.5px; font-weight: 600; color: var(--text-muted); margin-right: 4px; }
.cc-toggle { font: inherit; font-size: 12.5px; font-weight: 700; letter-spacing: .03em; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--text-muted); cursor: pointer; }
.cc-toggle[aria-pressed="true"] { background: var(--teal); border-color: var(--teal); color: #fff; }
.cc-swap { align-self: flex-end; font: inherit; font-size: 18px; line-height: 1; padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px; background: transparent; color: var(--text-strong); cursor: pointer; }
.cc-swap:hover { border-color: var(--line-strong); }


/* ==========================================================================
   Dashboard v2: KPI trends, charts and insight panels
   All colours come from the theme tokens, so dark mode needs no extra rules.
   ========================================================================== */
.dx {
  --dx-c0: var(--teal); --dx-c1: var(--blue); --dx-c2: var(--green); --dx-c3: var(--violet);
  --dx-c4: var(--gold); --dx-c5: var(--coral); --dx-c6: #5f6b85; --dx-c7: #c0508a;
}
.dx-span-8 { grid-column: span 8; }
.dx-lede { max-width: 56ch; }
.dx-head .dx-meta { flex-direction: column; align-items: flex-end; gap: 10px; }
.dx-btn-ghost { display: inline-flex; align-items: center; gap: 7px; margin-top: 0; align-self: auto; }
.dx-btn-ghost svg { width: 15px; height: 15px; }

/* key swatches */
.dx-key.c0 { background: var(--dx-c0); } .dx-key.c1 { background: var(--dx-c1); } .dx-key.c2 { background: var(--dx-c2); } .dx-key.c3 { background: var(--dx-c3); }
.dx-key.c4 { background: var(--dx-c4); } .dx-key.c5 { background: var(--dx-c5); } .dx-key.c6 { background: var(--dx-c6); } .dx-key.c7 { background: var(--dx-c7); }
.dx-key.k-in { background: var(--green); } .dx-key.k-out { background: var(--coral); } .dx-key.k-net { background: var(--blue); border-radius: 50%; }
.dx-key.k-pace { background: transparent; border: 2px dashed var(--gold); border-radius: 2px; }

/* second KPI row: cash flow with trend sparkline */
.dx-kpis-flow .dx-kpi { padding-top: 16px; }
.dx-kpi-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; }
.dx-kpi-flow .dx-kpi-value { font-size: 21px; }
.dx-kpi-icon.t-coral { background: var(--coral-dim); color: var(--coral); }
.dx-spark { display: block; flex: none; overflow: visible; }
.dx-kpi-flow .dx-spark { width: 100%; height: auto; max-height: 40px; margin-top: 8px; }
.dx-kpi-flow .dx-kpi-value { overflow-wrap: normal; white-space: nowrap; }
.dx-spark .spark-line { fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.dx-spark .spark-area { stroke: none; opacity: .14; }
.dx-spark .spark-dot { stroke: var(--bg-raised); stroke-width: 1.5; }
.dx-spark.tone-teal .spark-line { stroke: var(--teal); } .dx-spark.tone-teal .spark-area, .dx-spark.tone-teal .spark-dot { fill: var(--teal); }
.dx-spark.tone-green .spark-line { stroke: var(--green); } .dx-spark.tone-green .spark-area, .dx-spark.tone-green .spark-dot { fill: var(--green); }
.dx-spark.tone-coral .spark-line { stroke: var(--coral); } .dx-spark.tone-coral .spark-area, .dx-spark.tone-coral .spark-dot { fill: var(--coral); }
.dx-spark.tone-blue .spark-line { stroke: var(--blue); } .dx-spark.tone-blue .spark-area, .dx-spark.tone-blue .spark-dot { fill: var(--blue); }

.dx-delta { font-size: 12px; font-weight: 700; color: var(--text-muted); }
.dx-delta em { font-style: normal; font-weight: 500; color: var(--text-muted); }
.dx-delta.is-good { color: var(--green); } .dx-delta.is-bad { color: var(--coral); } .dx-delta.is-flat { font-weight: 500; }

.dx-pill { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 700; background: var(--teal-dim); color: var(--teal-ink, var(--teal)); white-space: nowrap; }
.dx-pill.is-good { background: var(--green-dim); color: var(--green); }
.dx-pill.is-bad { background: var(--coral-dim); color: var(--coral); }
.dx-pill.is-warn { background: var(--gold-dim); color: var(--gold); }

/* charts */
.dx-chart { position: relative; min-width: 0; }
.dx-chart .zero { stroke: var(--line-strong); stroke-width: 1; }
.dx-chart .grp:focus { outline: none; }
.dx-chart .grp:focus-visible .hit { stroke: var(--teal); stroke-width: 1.5; }
.dx-chart .bar-in { fill: var(--green); } .dx-chart .bar-out { fill: var(--coral); }
.dx-chart .grp:hover .bar-in, .dx-chart .grp.is-active .bar-in, .dx-chart .grp:hover .bar-out, .dx-chart .grp.is-active .bar-out { filter: brightness(1.08); }
.dx-chart .mlabel.is-active { fill: var(--text-strong); font-weight: 700; }
.dx-chart .net-line { fill: none; stroke: var(--blue); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; pointer-events: none; }
.dx-chart .net-dot { fill: var(--bg-raised); stroke: var(--blue); stroke-width: 2; pointer-events: none; }
.dx-chart .spend-area { fill: var(--coral); opacity: .13; }
.dx-chart .spend-line { fill: none; stroke: var(--coral); stroke-width: 2.4; stroke-linejoin: round; stroke-linecap: round; }
.dx-chart .pace-line { stroke: var(--gold); stroke-width: 1.6; stroke-dasharray: 5 4; }
.dx-chart .budget-line { stroke: var(--text-faint); stroke-width: 1; stroke-dasharray: 2 3; }
.dx-chart .budget-label { fill: var(--text-faint); font-size: 10.5px; }
.dx-chart .pace-dot { fill: var(--coral); stroke: var(--bg-raised); stroke-width: 2; }
.dx-chart .cursor { stroke: var(--line-strong); stroke-width: 1; }
.dx-chart .cursor-dot { fill: var(--bg-raised); stroke: var(--coral); stroke-width: 2; }
.dx-chart .overlay { cursor: crosshair; touch-action: pan-y; }

.dx-tip { position: absolute; z-index: 5; pointer-events: none; min-width: 150px; padding: 9px 11px; border-radius: 10px; background: var(--text-strong); color: var(--bg-raised); font-size: 12px; line-height: 1.5; box-shadow: var(--shadow-md); }
.dx-tip b { display: block; margin-bottom: 3px; font-size: 12px; }
.dx-tip .tip-row { display: flex; align-items: center; gap: 7px; }
.dx-tip .tip-row em { margin-left: auto; padding-left: 14px; font-style: normal; font-weight: 700; font-variant-numeric: tabular-nums; }
.dx-tip .is-neg { color: #f0967a; } .dx-tip .is-pos { color: #6fd6a5; }
.dx-tip .dx-key.k-pace { border-color: #e3b341; }

/* donut + legend list */
.dx-split { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 20px; align-items: center; position: relative; }
.dx-split-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.dx-donut-wrap { display: flex; justify-content: center; }
.dx-donut { display: block; max-width: 100%; height: auto; overflow: visible; }
.dx-donut .slice { stroke: var(--bg-raised); stroke-width: 2; cursor: pointer; transition: opacity .15s ease, transform .15s ease; outline: none; }
.dx-donut .slice.c0 { fill: var(--dx-c0); } .dx-donut .slice.c1 { fill: var(--dx-c1); } .dx-donut .slice.c2 { fill: var(--dx-c2); } .dx-donut .slice.c3 { fill: var(--dx-c3); }
.dx-donut .slice.c4 { fill: var(--dx-c4); } .dx-donut .slice.c5 { fill: var(--dx-c5); } .dx-donut .slice.c6 { fill: var(--dx-c6); } .dx-donut .slice.c7 { fill: var(--dx-c7); }
.dx-donut.has-active .slice { opacity: .3; } .dx-donut.has-active .slice.is-on { opacity: 1; }
.dx-donut .slice:focus-visible { stroke: var(--text-strong); }
.dx-donut .donut-empty { stroke: var(--parchment-dim); }
.dx-donut .donut-label { fill: var(--text-muted); font-size: 10.5px; font-weight: 600; }
.dx-donut .donut-value { fill: var(--text-strong); font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; }

.dx-legend-list { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.dx-legend-btn { width: 100%; display: flex; align-items: center; gap: 10px; padding: 9px 10px; border: 0; border-radius: 10px; background: transparent; text-align: left; font: inherit; color: inherit; cursor: pointer; min-width: 0; transition: background .15s ease; }
.dx-legend-btn.is-static { cursor: default; }
.dx-legend-row:hover .dx-legend-btn, .dx-legend-row.is-on .dx-legend-btn { background: var(--parchment); }
.dx-legend-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.dx-legend-name { font-size: 13px; font-weight: 600; color: var(--text-strong); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dx-legend-note { font-size: 11.5px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dx-legend-fig { display: flex; flex-direction: column; align-items: flex-end; flex: none; }
.dx-legend-fig b { font-size: 13px; font-weight: 700; color: var(--text-strong); white-space: nowrap; }
.dx-legend-fig em { font-style: normal; font-size: 11.5px; color: var(--text-muted); }
#cashInHandDetail { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }

/* budget / health / goals / emergency fund */
.dx-big-sm { font-size: 22px; }
.dx-budget-badges { display: flex; gap: 6px; flex-wrap: wrap; }
.dx-list-fig b { font-weight: 700; color: var(--text-strong); } .dx-list-fig b.is-neg { color: var(--coral); }

.dx-health-card { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 4px 0 2px; }
.dx-gauge { display: block; max-width: 100%; height: auto; }
.dx-gauge .g-track { fill: none; stroke: var(--parchment-dim); stroke-width: 14; stroke-linecap: round; }
.dx-gauge .g-value { fill: none; stroke: var(--teal); stroke-width: 14; stroke-linecap: round; transition: stroke-dasharray .6s ease; }
.dx-gauge.excellent .g-value, .dx-gauge.very-healthy .g-value { stroke: var(--green); }
.dx-gauge.healthy .g-value { stroke: var(--gold); }
.dx-gauge.needs-attention .g-value, .dx-gauge.at-risk .g-value, .dx-gauge.critical .g-value { stroke: var(--coral); }
.dx-gauge.unset .g-value { stroke: var(--text-faint); }
.dx-gauge .g-num { fill: var(--text-strong); font-size: 34px; font-weight: 700; }
.dx-gauge .g-of { fill: var(--text-muted); font-size: 11px; }
.dx-health-card .dx-health-level { font-size: 16px; }
.dx-health-card .dx-health-tip { max-width: 40ch; -webkit-line-clamp: 3; }

.dx-goals { display: flex; flex-direction: column; gap: 12px; }
.dx-goal { display: flex; align-items: center; gap: 12px; min-width: 0; }
.dx-goal-main { display: flex; flex-direction: column; min-width: 0; }
.dx-goal-name { font-size: 13px; font-weight: 600; color: var(--text-strong); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dx-goal-sub { font-size: 12px; color: var(--text-muted); }
.dx-mini-ring { flex: none; }
.dx-mini-ring .r-track { fill: none; stroke: var(--parchment-dim); }
.dx-mini-ring .r-value { fill: none; stroke: var(--teal); stroke-linecap: round; transition: stroke-dasharray .6s ease; }
.dx-mini-ring.tone-blue .r-value { stroke: var(--blue); } .dx-mini-ring.tone-green .r-value { stroke: var(--green); } .dx-mini-ring.tone-coral .r-value { stroke: var(--coral); }
.dx-mini-ring text { fill: var(--text-strong); font-size: 11px; font-weight: 700; }
.dx-ef { display: flex; align-items: center; gap: 16px; }
.dx-ef .dx-mini-ring text { font-size: 15px; }
.dx-ef-main { min-width: 0; }
.dx-ef-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }

@media (max-width: 1100px) {
  .dx-span-8 { grid-column: span 12; }
  .dx-head .dx-meta { align-items: flex-start; }
}
@media (max-width: 800px) {
  .dx-split { grid-template-columns: minmax(0, 1fr); justify-items: stretch; }
  .dx-kpi-flow .dx-kpi-value { font-size: 18px; }
  .dx-lede { display: block; font-size: 13px; }
  .dx-head .dx-meta { width: 100%; flex-direction: row; justify-content: space-between; align-items: center; }
  .dx-tip { min-width: 130px; }
}
@media print {
  .dx-btn-ghost, .dx-tip { display: none !important; }
  .dx-card { break-inside: avoid; box-shadow: none; }
}

/* list spacing: `.dx ul { margin: 0 }` outranks the bare class, so restate it with the .dx prefix */
.dx .dx-list { margin-top: 14px; }
.dx .dx-bills { margin-top: 12px; }
/* the wealth card is narrow, so its donut sits above the legend instead of beside it */
#dxWealth .dx-split { grid-template-columns: minmax(0, 1fr); justify-items: stretch; gap: 14px; }
@media (max-width: 1100px) { #dxWealth .dx-split { grid-template-columns: auto minmax(0, 1fr); } }
@media (max-width: 800px) { #dxWealth .dx-split { grid-template-columns: minmax(0, 1fr); } }

/* mobile.css makes an even last KPI span the full row (right for the first row); the flow row stays a 2x2 grid */
.dx .dx-kpis-flow > .dx-kpi:last-child:nth-child(even) { grid-column: auto; }
@media (max-width: 560px) {
  .dx-flow-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 8px; }
  .dx-flow-stats .dx-flow-stat:last-child { grid-column: 1 / -1; }
  .dx-flow-stat strong { font-size: 15px; }
}


/* ==========================================================================
   Reports overview (.rp-*) -- rides on the Dashboard's .dx cards, charts and
   tokens; only what is new for Reports lives here.
   ========================================================================== */
.rp .rp-head { align-items: flex-end; }
.rp-controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.rp-monthnav { display: inline-flex; align-items: center; gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg-raised); box-shadow: var(--shadow-sm); }
.rp-nav-btn { width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 9px; background: transparent; color: var(--text-strong); cursor: pointer; }
.rp-nav-btn svg { width: 15px; height: 15px; }
.rp-nav-btn:hover:not(:disabled) { background: var(--parchment-dim); }
.rp-nav-btn:disabled { color: var(--text-faint); cursor: default; }
.rp-month { min-width: 128px; text-align: center; font-size: 13.5px; font-weight: 650; color: var(--text-strong); font-variant-numeric: tabular-nums; }
.rp-primary { display: inline-flex; align-items: center; gap: 7px; padding: 9px 14px; border: 0; border-radius: 10px; background: var(--ctl-bg); color: #fff; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.rp-primary:hover { background: var(--ctl-bg-hover); }
.rp-primary svg { width: 15px; height: 15px; }

/* "what stands out" chips */
.rp-highlights { display: flex; flex-wrap: wrap; gap: 8px; margin: -6px 0 var(--dx-gap); }
.rp-highlights:empty { display: none; }
.rp-chip { display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg-raised); font-size: 12.5px; font-weight: 550; color: var(--text-strong); line-height: 1.35; }
.rp-chip i { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--teal); }
.rp-chip.is-good i { background: var(--green); } .rp-chip.is-warn i { background: var(--gold); } .rp-chip.is-warn { background: var(--gold-dim); border-color: transparent; }
.rp-chip.is-good { background: var(--green-dim); border-color: transparent; }

.rp-kpis { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.rp-kpis .dx-kpi-value { font-size: 21px; }
.rp-kpis .dx-spark { width: 100%; height: auto; max-height: 38px; margin-top: 8px; }
.rp-of { font-size: 13px; font-weight: 500; color: var(--text-muted); letter-spacing: 0; }
.rp-health-track { margin: 8px 0 2px; }
.rp-sub { margin: 0; }

/* segmented range switch */
.rp-seg { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--parchment-dim); }
.rp-seg button { border: 0; background: transparent; padding: 5px 11px; border-radius: 8px; font: inherit; font-size: 12px; font-weight: 650; color: var(--text-muted); cursor: pointer; }
.rp-seg button.active { background: var(--bg-raised); color: var(--text-strong); box-shadow: var(--shadow-sm); }

/* chart bits */
.rp-chart { position: relative; }
.rp-chart .rp-prev-line { fill: none; stroke: var(--text-faint); stroke-width: 2; stroke-dasharray: 5 4; stroke-linejoin: round; }
.rp-chart .rp-bar { fill: var(--coral); opacity: .82; }
.rp-chart .rp-bar.is-peak { opacity: 1; fill: var(--gold); }
.rp-chart .rp-avg-line { stroke: var(--text-muted); stroke-width: 1; stroke-dasharray: 4 3; }
.rp-chart .bar-sav { fill: var(--dx-save); }
.rp-chart .rp-rate-line { fill: none; stroke: var(--gold); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; pointer-events: none; }
.rp-chart .rp-rate-dot { fill: var(--bg-raised); stroke: var(--gold); stroke-width: 2; pointer-events: none; }
.dx-key.rp-k-prev { background: transparent; border: 2px dashed var(--text-faint); height: 0; width: 14px; border-radius: 0; border-width: 2px 0 0; }
.dx-key.rp-k-net { background: var(--blue); border-radius: 50%; }
.dx-key.rp-k-save { background: var(--dx-save); } .dx-key.rp-k-rate { background: var(--gold); border-radius: 50%; }
.dx-key.k-pace { background: transparent; border-top: 2px dotted var(--text-faint); height: 0; width: 14px; border-radius: 0; }

.rp .dx-stat dd small { display: block; margin-top: 2px; font-size: 11.5px; font-weight: 500; color: var(--text-muted); }
.rp-stats { margin: 4px 0 14px; }
.rp .dx-card .dx-chart + .dx-legend { margin-top: 10px; }
.rp .dx-card .dx-readout { margin-top: 12px; }
.rp .dx-card .dx-stat dd { font-size: 14.5px; }

/* month at a glance */
.rp-glance { display: flex; flex-direction: column; gap: 18px; }
.rp-glance-row > div:first-child { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.rp-glance-label { font-size: 12.5px; font-weight: 600; color: var(--text-muted); }
.rp-glance-row strong { font-size: 17px; font-weight: 700; color: var(--text-strong); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; text-align: right; }
.rp-glance-row small { display: block; margin: 3px 0 7px; font-size: 12px; color: var(--text-muted); }
.rp-glance-row small b { font-weight: 650; }
.rp-glance-row .dx-track { margin-top: 6px; }

/* weekday pattern */
.rp-weekday { margin-top: 4px; padding-top: 14px; border-top: 1px solid var(--line); }
.rp-weekday-title { font-size: 12px; color: var(--text-muted); margin-bottom: 10px; }
.rp-weekday-title b { color: var(--text-strong); font-weight: 650; }
.rp-weekday-cols { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; align-items: end; }
.rp-wd { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; }
.rp-wd-bar { width: 100%; height: 64px; display: flex; align-items: flex-end; border-radius: 8px; background: var(--parchment-dim); overflow: hidden; }
.rp-wd-bar i { display: block; width: 100%; border-radius: 8px 8px 0 0; background: var(--dx-c1); opacity: .75; transition: height .5s ease; }
.rp-wd.is-top .rp-wd-bar i { background: var(--gold); opacity: 1; }
.rp-wd em { font-style: normal; font-size: 11.5px; font-weight: 600; color: var(--text-muted); }
.rp-wd small { font-size: 10.5px; color: var(--text-faint); font-variant-numeric: tabular-nums; }

/* donut legend sits under the donut on Reports */
.rp-legend { margin-top: 14px; }
#rpBreakdown .dx-donut-wrap { margin-bottom: 2px; }

/* category movement */
.rp-move { display: flex; flex-direction: column; gap: 14px; }
.rp-move-row { display: flex; gap: 12px; align-items: flex-start; min-width: 0; }
.rp-move-ico { flex: none; width: 34px; height: 34px; border-radius: 10px; background: var(--teal-dim); color: var(--teal); display: inline-flex; align-items: center; justify-content: center; }
.rp-move-ico svg { width: 17px; height: 17px; }
.rp-move-main { flex: 1; min-width: 0; }
.rp-move-top { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; }
.rp-move-top b { font-weight: 650; color: var(--text-strong); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.rp-move-top span { font-weight: 700; color: var(--text-strong); font-variant-numeric: tabular-nums; white-space: nowrap; }
.rp-move-bars { display: flex; flex-direction: column; gap: 3px; margin: 6px 0 5px; }
.rp-move-bars i { display: block; height: 6px; border-radius: 999px; min-width: 2px; }
.rp-move-bars .is-now { background: var(--coral); }
.rp-move-bars .is-prev { background: var(--text-faint); opacity: .45; height: 4px; }
.rp-move-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 11.5px; color: var(--text-muted); }
.rp-move-foot span { font-variant-numeric: tabular-nums; }

/* members */
.rp-dual { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px; margin-top: 6px; }
.rp-dual small { min-width: 86px; text-align: right; font-size: 11.5px; color: var(--text-muted); font-variant-numeric: tabular-nums; }

/* biggest expenses */
.rp-top { list-style: none; display: flex; flex-direction: column; gap: 4px; margin: 0; padding: 0; }
.rp-top li { display: flex; align-items: center; gap: 12px; padding: 9px 4px; border-top: 1px solid var(--line); min-width: 0; }
.rp-top li:first-child { border-top: 0; }
.rp-rank { flex: none; width: 24px; height: 24px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 11.5px; font-weight: 700; background: var(--parchment-dim); color: var(--text-muted); }
.rp-top-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.rp-top-main b { font-size: 13px; font-weight: 600; color: var(--text-strong); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rp-top-main small { font-size: 11.5px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rp-top strong { flex: none; font-size: 13px; font-weight: 700; color: var(--coral); font-variant-numeric: tabular-nums; }

/* goals */
.rp-goals2 { list-style: none; display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 10px 18px; margin: 0; padding: 0; }
.rp-goal2 { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; min-width: 0; }
.rp-goal2-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.rp-goal2-main b { font-size: 13.5px; font-weight: 650; color: var(--text-strong); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rp-goal2-main small, .rp-goal2-left { font-size: 11.5px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.rp-goal2-left { flex: none; text-align: right; }

/* bills */
.rp-bill-bar { margin: 12px 0 14px; }
.rp-seg-paid { background: var(--green); } .rp-seg-due { background: var(--gold); } .rp-seg-over { background: var(--coral); }
.rp-upcoming { list-style: none; margin: 0; padding: 0; }
.rp-upcoming li { display: flex; align-items: baseline; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 13px; }
.rp-upcoming li span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-strong); font-weight: 550; }
.rp-upcoming li small { color: var(--text-muted); font-size: 11.5px; }
.rp-upcoming li b { font-variant-numeric: tabular-nums; color: var(--text-strong); }

/* wealth + emergency fund */
.rp-wealth-bar { margin-top: 14px; }
.rp-swatch { width: 10px; height: 10px; min-width: 10px; border-radius: 3px; flex: none; }
.rp-ef { margin-top: 6px; }
.rp-ef .dx-mini-ring { width: 96px; height: 96px; }

@media (max-width: 1280px) { .rp-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 1100px) { .dx-span-8 { grid-column: span 12; } }
@media (max-width: 800px) {
  .rp .rp-head { align-items: flex-start; }
  .rp-controls { width: 100%; justify-content: space-between; }
  .rp-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rp-kpis .dx-kpi:last-child { grid-column: span 2; }
  .rp-kpis .dx-kpi-value { font-size: 18px; }
  .rp-month { min-width: 110px; }
  .rp-goals2 { grid-template-columns: minmax(0, 1fr); }
  .rp-weekday-cols { gap: 5px; }
}
@media print {
  .rp-controls, .rp-seg { display: none !important; }
  .rp-chip { break-inside: avoid; }
}
.rp .dx-eyebrow svg { width: 14px; height: 14px; flex: none; }
.rp .dx-btn-ghost svg, .rp-primary svg { width: 15px; height: 15px; flex: none; }
.rp-kpis .dx-kpi-value { font-size: 19px; }
.dx-key.rp-k-budget { background: transparent; border-top: 2px dotted var(--text-muted); height: 0; width: 16px; border-radius: 0; }
.rp .dx-fill.is-in { background: var(--green); }
.rp-stats { grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); }
.rp-stats .dx-stat dd { font-size: 14px; }
.rp-upcoming { margin-top: 12px; }
@media (max-width: 420px) { .rp-stats .dx-stat:last-child { grid-column: auto; } }

/* ==========================================================================
   Reports > Export / Import polish (CSS only; markup and ids unchanged)
   ========================================================================== */
.reports-tabs { max-width: 420px; padding: 3px; border-radius: 12px; }
.dp-intro { font-size: 14px; margin: 4px 2px 18px; max-width: 64ch; }
.dp-grid { gap: 16px; }
.dp-card { border-radius: 14px; padding: 20px; border: 1px solid var(--line); background: var(--bg-raised); box-shadow: var(--shadow-card, var(--shadow-sm)); transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease; }
.dp-card:hover { border-color: var(--line-strong); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.dp-card-title { font-family: inherit; font-size: 15px; font-weight: 700; letter-spacing: -0.01em; }
.dp-card-desc { font-size: 13px; }
.dp-fields { padding-top: 12px; border-top: 1px solid var(--line); }
.dp-formats { padding-top: 10px; gap: 8px; }
.dp-formats .btn { border-radius: 9px; font-weight: 600; min-width: 64px; }
.dp-note { padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--parchment); }
.dp-scroll { border-radius: 12px; }
.dp-table th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; }
.dp-table tbody tr:hover td { background: var(--bg-hover); }
.dp-hint { border-radius: 10px; }
@media (prefers-reduced-motion: reduce) { .dp-card { transition: none; } .dp-card:hover { transform: none; } }

/* ==========================================================================
   Financial Health: balance radar + per-part trend lines
   ========================================================================== */
.fhx-dims-layout { display: grid; grid-template-columns: minmax(230px, 300px) minmax(0, 1fr); gap: 28px; align-items: center; }
.fhx-radar-wrap { text-align: center; }
.fhx-radar { width: 100%; max-width: 300px; height: auto; overflow: visible; }
.fhx-radar-ring { fill: none; stroke: var(--line); stroke-width: 1; }
.fhx-radar-spoke { stroke: var(--line); stroke-width: 1; }
.fhx-radar-shape { fill: var(--teal); fill-opacity: .18; stroke: var(--teal); stroke-width: 2; stroke-linejoin: round; }
.fhx-radar-dot { stroke: var(--bg-raised); stroke-width: 2; fill: var(--teal); }
.fhx-radar-dot.good { fill: var(--green); } .fhx-radar-dot.fair { fill: var(--gold); } .fhx-radar-dot.low { fill: var(--coral); }
.fhx-radar-label { fill: var(--text-strong); font-size: 11px; font-weight: 650; }
.fhx-radar-label.dim { fill: var(--text-faint); }
.fhx-dim-head { align-items: center; }
.fhx-dim-spark { margin-left: auto; margin-right: 12px; display: inline-flex; }
.fhx-dim-spark .dx-spark { width: 64px; height: 22px; }
.dx-spark.tone-blue .spark-line { stroke: var(--blue); } .dx-spark.tone-blue .spark-area, .dx-spark.tone-blue .spark-dot { fill: var(--blue); }
@media (max-width: 800px) { .fhx-dims-layout { grid-template-columns: minmax(0, 1fr); gap: 12px; } .fhx-dim-spark { display: none; } }

/* ==========================================================================
   Bills (.bl-*) -- rides on the Dashboard's .dx cards, KPIs and charts
   ========================================================================== */
.bl .bl-bar { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: var(--dx-gap); }
.bl .bl-bar .dx-lede { margin: 0; max-width: 60ch; }
.bl .bl-form { margin-bottom: var(--dx-gap); }
.bl .bl-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.bl .dx-grid { margin-bottom: var(--dx-gap); }
.rp-chart .rp-due { fill: var(--gold); }
.rp-chart .rp-due.is-over { fill: var(--coral); }
.dx-key.rp-k-due { background: var(--gold); }

.bl-toolbar { display: flex; flex-wrap: wrap; gap: 10px 22px; margin: 0 0 var(--dx-gap); }
.bl-chips { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.bl-chip { display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--bg-raised); font: inherit; font-size: 12.5px; font-weight: 600; color: var(--text-muted); cursor: pointer; }
.bl-chip em { font-style: normal; font-size: 11px; padding: 1px 7px; border-radius: 999px; background: var(--parchment-dim); color: var(--text-muted); }
.bl-chip:hover { color: var(--text-strong); border-color: var(--line-strong); }
.bl-chip.active { background: var(--ctl-bg); border-color: var(--ctl-bg); color: #fff; }
.bl-chip.active em { background: rgba(255, 255, 255, .2); color: #fff; }

.bl-group { margin-bottom: var(--dx-gap); }
.bl-group.is-over { border-color: color-mix(in srgb, var(--coral) 45%, var(--line)); }
.bl-count { margin-left: 8px; font-size: 11.5px; font-weight: 650; padding: 1px 8px; border-radius: 999px; background: var(--parchment-dim); color: var(--text-muted); }
.bl-sum { font-size: 13.5px; font-weight: 700; color: var(--text-strong); font-variant-numeric: tabular-nums; }
.bl-rows { list-style: none; margin: 0; padding: 0; }
.bl-row { display: grid; grid-template-columns: 46px minmax(0, 1fr) auto auto; align-items: center; gap: 14px; padding: 12px 2px; border-top: 1px solid var(--line); }
.bl-row:first-child { border-top: 0; }
.bl-date { width: 46px; height: 50px; border-radius: 12px; background: var(--parchment-dim); display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.1; }
.bl-date b { font-size: 17px; font-weight: 750; color: var(--text-strong); font-variant-numeric: tabular-nums; }
.bl-date span { font-size: 10.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); }
.bl-row.is-over .bl-date { background: var(--coral-dim); } .bl-row.is-over .bl-date b { color: var(--coral); }
.bl-row.is-paid .bl-name, .bl-row.is-paid .bl-amount { opacity: .6; }
.bl-main { min-width: 0; }
.bl-name { font-size: 14px; font-weight: 650; color: var(--text-strong); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bl-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-top: 3px; font-size: 12px; color: var(--text-muted); }
.bl-due.is-over { color: var(--coral); font-weight: 650; } .bl-due.is-soon { color: var(--gold); font-weight: 650; } .bl-due.is-paid { color: var(--green); font-weight: 650; }
.bl-tag { font-size: 10.5px; font-weight: 650; padding: 1px 8px; border-radius: 999px; background: var(--parchment-dim); color: var(--text-muted); }
.bl-tag.is-debt { background: var(--coral-dim); color: var(--coral); }
.bl-amount { font-size: 15px; font-weight: 700; color: var(--text-strong); font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }
.bl-actions { display: flex; align-items: center; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.bl-type { padding: 5px 8px; font-size: 12px; border-radius: 8px; max-width: 150px; }
.bl-more { display: block; width: 100%; margin-top: 8px; padding: 9px; border: 1px dashed var(--line-strong, var(--line)); border-radius: 10px; background: transparent; font: inherit; font-size: 13px; font-weight: 600; color: var(--text-muted); cursor: pointer; }
.bl-more:hover { color: var(--text-strong); background: var(--parchment-dim); }
.bl-kinds { margin-top: 16px; display: flex; flex-direction: column; gap: 6px; }
.bl-kind { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--text-muted); }
.bl-kind b { color: var(--text-strong); font-variant-numeric: tabular-nums; }

@media (max-width: 1100px) { .bl .bl-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 800px) {
  .bl-row { grid-template-columns: 46px minmax(0, 1fr) auto; }
  .bl-actions { grid-column: 1 / -1; justify-content: flex-start; }
  .bl-type { max-width: none; flex: 1 1 140px; }
}
@media (max-width: 480px) { .bl .bl-kpis { grid-template-columns: minmax(0, 1fr); } }

/* Savings insights row (.sg-insights) */
.sg-insights { margin: 0 0 18px; }
.sg-insights .dx-donut-wrap { margin-bottom: 4px; }
.sg-legend { margin-top: 10px; }
.sg-prog .dx-fill.is-in { background: var(--dx-save); }
.sg-insights .dx-readout b { font-weight: 700; color: var(--text-strong); }

/* Budget Plan charts row */
.bp-charts { margin: 0 0 18px; }
.bp-charts:empty { display: none; }
.bp-charts .dx-donut-wrap { margin-bottom: 4px; }
.bp-legend { margin-top: 10px; }
.bp-charts .dx-readout b { font-weight: 700; color: var(--text-strong); }

/* Simple / Advanced switch */
.dx-simple .dx-adv { display: none !important; }
.dx-mode { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--parchment-dim, rgba(120,130,150,.14)); border: 1px solid var(--line); }
.dx-mode button { border: 0; background: transparent; color: var(--text-muted); font: inherit; font-size: 13px; font-weight: 600; padding: 7px 16px; border-radius: 999px; min-height: 34px; cursor: pointer; }
.dx-mode button.is-on { background: var(--teal, #107e96); color: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.18); }
@media (max-width: 640px) { .dx-mode { width: 100%; } .dx-mode button { flex: 1; min-height: 40px; } }

/* Header controls, decluttered: date, Simple/Advanced switch and Full reports sit on ONE tidy row on wide screens,
   and on phones the switch gets its own full-width row with the date and button underneath. */
.dx .dx-head .dx-meta { display: flex; flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 10px 14px; width: auto; text-align: left; }
.dx .dx-head .dx-meta .dx-date { order: 0; white-space: nowrap; margin-right: 4px; }
.dx .dx-head .dx-meta .dx-mode { order: 1; }
.dx .dx-head .dx-meta .dx-btn { order: 2; margin: 0; white-space: nowrap; }
@media (max-width: 640px) {
  .dx .dx-head { margin-bottom: 16px; }
  .dx .dx-head .dx-meta { width: 100%; justify-content: space-between; gap: 12px; }
  .dx .dx-head .dx-meta .dx-mode { order: -1; flex: 0 0 100%; width: 100%; }
  .dx .dx-head .dx-meta .dx-date { margin: 0; font-size: 12.5px; }
  .dx .dx-head .dx-meta .dx-btn { padding: 8px 14px; min-height: 38px; }
}

/* ---- Modern header: one soft banner card holding greeting + controls ---- */
.dx .dx-head {
  position: relative; padding: 20px 24px; margin-bottom: 20px; border-radius: 20px;
  background: linear-gradient(135deg, var(--bg-raised, #fff) 0%, color-mix(in srgb, var(--teal, #107e96) 7%, var(--bg-raised, #fff)) 100%);
  border: 1px solid var(--line); box-shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 8px 24px -12px rgba(16, 24, 40, .12);
  align-items: center; overflow: hidden;
}
.dx .dx-head::before { content: ""; position: absolute; left: 0; top: 18px; bottom: 18px; width: 4px; border-radius: 0 4px 4px 0; background: linear-gradient(var(--teal, #107e96), var(--green, #2e9e6b)); }
.dx .dx-head .dx-eyebrow { letter-spacing: .08em; font-size: 11.5px; }
.dx .dx-head .dx-title { font-size: 26px; }
.dx .dx-head .dx-date {
  display: inline-flex; align-items: center; gap: 7px; padding: 8px 13px; border-radius: 999px;
  background: var(--bg-hover, rgba(120,130,150,.1)); border: 1px solid var(--line); font-size: 12.5px; font-weight: 600; color: var(--text-muted); margin-right: 0;
}
.dx .dx-head .dx-date::before {
  content: ""; width: 14px; height: 14px; background: currentColor; flex: none;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='5' width='18' height='16' rx='3'/%3E%3Cpath d='M8 3v4M16 3v4M3 10h18'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='5' width='18' height='16' rx='3'/%3E%3Cpath d='M8 3v4M16 3v4M3 10h18'/%3E%3C/svg%3E") center / contain no-repeat;
}
.dx .dx-mode { padding: 4px; background: var(--bg-hover, rgba(120,130,150,.12)); box-shadow: inset 0 1px 2px rgba(16, 24, 40, .06); }
.dx .dx-mode button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; transition: background .15s ease, color .15s ease, box-shadow .15s ease; }
.dx .dx-mode button.is-on { box-shadow: 0 2px 6px -1px color-mix(in srgb, var(--teal, #107e96) 55%, transparent); }
.dx .dx-mode button:not(.is-on):hover { color: var(--text-strong); }
.dx .dx-head .dx-btn-ghost { border-radius: 999px; padding: 8px 16px; font-weight: 600; border-color: color-mix(in srgb, var(--teal, #107e96) 45%, var(--line)); color: var(--teal, #107e96); background: var(--bg-raised, #fff); transition: background .15s ease, box-shadow .15s ease; }
.dx .dx-head .dx-btn-ghost:hover { background: color-mix(in srgb, var(--teal, #107e96) 8%, var(--bg-raised, #fff)); box-shadow: 0 2px 8px -2px color-mix(in srgb, var(--teal, #107e96) 40%, transparent); }
@media (max-width: 640px) {
  .dx .dx-head { padding: 16px 16px 16px 18px; border-radius: 18px; }
  .dx .dx-head .dx-title { font-size: 22px; }
  .dx .dx-head .dx-meta .dx-date { padding: 7px 11px; }
}
@media (prefers-reduced-motion: reduce) { .dx .dx-mode button, .dx .dx-head .dx-btn-ghost { transition: none; } }

/* Simple view keeps "Where the money is" (bank, CASH IN HAND with its per-member detail, savings, investments),
   full width, right under the summary cards; only the cash-flow trend chart beside it is Advanced. */
.dx-simple #dxWealth { grid-column: 1 / -1; }

/* Desktop: Advanced only, no switch. */
@media (min-width: 1025px) { .dx .dx-mode { display: none !important; } }
