/* ============================================================
   DASHBOARD.CSS — Flow terminal grid: hairline cells, sharp
   corners, uppercase mono labels (trading-desk read)
   ============================================================ */

/* ============================================================
   TERMINAL PRIMITIVES
   ============================================================ */
.term {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  min-width: 0;
}
.term__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--color-border);
}
.term__title,
.term-label {
  font-family: var(--font-display);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--color-text-muted);
}
.term__title { font-size: 0.6875rem; }
.term-label  { font-size: 0.625rem; }
.term__body { padding: 14px; }
.term__body--flush { padding: 6px 12px; }
/* Head that stacks a range toggle beneath the title/nav row */
.term__head--stack { flex-direction: column; align-items: stretch; gap: 9px; }
.term__head-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.seg-toggle--full { display: flex; width: 100%; }
.seg-toggle--full .seg-btn { flex: 1; padding: 6px 4px; }

/* Hairline cell frame: shared 1px dividers via gap-on-border-bg */
.term-cells {
  background: var(--color-border);
  border: 1px solid var(--color-border);
  display: grid;
  gap: 1px;
}
.cell { background: var(--color-surface); min-width: 0; }
.cell-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--color-border);
}
.cell-body { padding: 14px; }

/* ============================================================
   STAT BAR — horizontal hairline cells across the top
   ============================================================ */
.dash-statbar {
  display: flex;
  align-items: stretch;
  flex-wrap: wrap;
  background: var(--color-border);
  border: 1px solid var(--color-border);
  gap: 1px;
}
.statbar__cell {
  background: var(--color-surface);
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  flex: 1 1 auto;
  min-width: 116px;
}
.statbar__cell--balance { flex: 2 1 220px; }
.statbar__balance-row { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }

.rail-count__num {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.04em;
  color: var(--color-text);
  line-height: 1.1;
}
.rail-count__label { font-size: 0.6875rem; color: var(--color-text-muted); }

.rail-balance {
  font-size: clamp(1.5rem, 2.2vw, 2rem);
  font-weight: 600;
  color: #ffffff;
  line-height: 1.1;
  word-break: break-all;
}

.rail-mini__value {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.03em;
  font-size: 0.9375rem;
}

/* Net worth + Crypto are headline totals too — give them the hero balance's
   white-on-black weight so they read as rewarding, a half-step below the
   "Current balance" figure rather than as muted footnotes. */
.statbar__cell--nw .rail-mini__value,
.statbar__cell--crypto .rail-mini__value {
  font-size: clamp(1.375rem, 1.9vw, 1.75rem);
  color: #ffffff;
  line-height: 1.1;
  letter-spacing: -0.04em;
  word-break: break-all;
}

.statbar__add {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 22px;
  background: #ffffff;
  color: #0a0a0a;
  font-weight: 600;
  font-size: 0.8125rem;
  text-decoration: none;
  flex: 0 0 auto;
  transition: background var(--transition);
}
.statbar__add:hover { background: #e6e6ea; text-decoration: none; color: #0a0a0a; }
/* on mobile the bottom-nav FAB already covers adding a transaction */
@media (max-width: 768px) { .statbar__add { display: none; } }

/* ============================================================
   DASH BODY — main (1fr) + transactions feed
   ============================================================ */
.dash-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 332px;
  gap: 10px;
  /* stretch so both columns share the taller height and their bottoms align
     (the transactions feed grows to fill — see .dash-feed below) */
  align-items: stretch;
}
.dash-main,
.dash-right {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
@media (max-width: 1100px) {
  .dash-body { grid-template-columns: 1fr; }
  .statbar__cell--balance { flex-basis: 100%; }
}

/* ============================================================
   ACCOUNT TILES — flush hairline cells
   ============================================================ */
.dash-tiles {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}
/* one tile per row on phones — 2-up is too narrow and truncates balances */
@media (max-width: 560px) {
  .dash-tiles { grid-template-columns: 1fr; }
}
.dash-tiles .empty-state { background: var(--color-surface); grid-column: 1 / -1; }

.acct-tile {
  background: var(--color-surface);
  padding: 14px 16px;
  transition: background var(--transition);
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.acct-tile:hover { background: var(--color-surface-2); }

.acct-tile__top {
  display: flex;
  align-items: center;
  gap: 8px;
}
.acct-tile__avatar {
  width: 28px; height: 28px;
  border-radius: 0;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-size: 0.8125rem; font-weight: 600;
  color: var(--color-text);
  flex-shrink: 0;
}

.acct-tile__id { min-width: 0; }
.acct-tile__name {
  font-size: 0.8125rem; font-weight: 500; color: var(--color-text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.acct-tile__type {
  font-family: var(--font-display);
  font-size: 0.625rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

/* lower row: figures on the left, a big graph on the right */
.acct-tile__main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.acct-tile__figures { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.acct-tile__chartcol { flex: 0 0 46%; max-width: 46%; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.acct-tile__chart { width: 100%; height: 44px; }
.acct-tile__chart .spark { display: block; width: 100%; height: 100%; opacity: .9; }

/* dashboard tiles: graph up in the top row (beside the name); balance +
   % change on the row below */
.acct-tile__row1 { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.acct-tile__row1 .acct-tile__top { flex: 1; min-width: 0; }
.acct-tile__row1 .acct-tile__chart { flex: 0 0 38%; max-width: 38%; height: 40px; }
.acct-tile__row2 { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.acct-tile__row2 .acct-tile__figures { min-width: 0; }

.acct-tile__bal {
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--color-text);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.spark { opacity: .9; }

.delta {
  font-family: var(--font-display);
  font-size: 0.6875rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.delta--up   { color: var(--color-income); }
.delta--down { color: var(--color-expense); }
.delta--flat { color: var(--color-text-muted); }

/* Crypto wallet tiles reuse the account-tile design, distinguished only
   by a chain-colored coin badge + a coin-amount sub-line. */
.acct-tile__sub {
  font-family: var(--font-display);
  font-size: 0.72rem;
  color: var(--color-text-muted);
  margin: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.crypto-acct-tile { position: relative; }
.crypto-acct-tile .acct-tile__avatar {
  color: var(--chain, var(--color-text));
  border-color: color-mix(in srgb, var(--chain, var(--color-border)) 45%, var(--color-border));
  background: color-mix(in srgb, var(--chain, transparent) 14%, transparent);
  font-size: 0.6rem;
}
/* edit/remove controls on the Crypto page tiles (not on the dashboard) */
.crypto-tile__actions { position: absolute; top: 6px; right: 6px; display: flex; gap: 2px; background: var(--color-surface); padding: 1px; }
.crypto-tile__edit,
.crypto-tile__del {
  display: inline-flex; align-items: center; justify-content: center;
  background: none; border: none; cursor: pointer;
  color: var(--color-text-light); padding: 4px; line-height: 1;
  opacity: 0.55; transition: opacity var(--transition), color var(--transition);
}
.crypto-tile__del { font-size: 0.85rem; }
.crypto-tile__edit:hover { opacity: 1; color: var(--color-text); }
.crypto-tile__del:hover { opacity: 1; color: var(--color-expense); }
.crypto-rename-input {
  font-family: var(--font-body);
  font-size: 0.8125rem; font-weight: 500;
  color: var(--color-text);
  background: var(--color-surface-2);
  border: 1px solid var(--chain, var(--color-border));
  padding: 2px 6px; width: 100%; max-width: 150px; outline: none;
}

/* ============================================================
   CRYPTO — holdings section (per-wallet tiles + net worth)
   ============================================================ */
.dash-crypto { display: flex; flex-direction: column; gap: 8px; }
/* indeterminate loading bar shown while a new timeframe is fetched */
.crypto-loadbar { height: 2px; background: var(--color-border); overflow: hidden; }
.crypto-loadbar[hidden] { display: none; }
.crypto-loadbar span {
  display: block; height: 100%; width: 40%;
  background: var(--color-text);
  animation: cryptoLoad 1s ease-in-out infinite;
}
@keyframes cryptoLoad {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(350%); }
}
@media (prefers-reduced-motion: reduce) {
  .crypto-loadbar span { animation: none; width: 100%; opacity: 0.5; }
}
.dash-crypto__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 2px 2px 0;
}
.dash-crypto__head-right { display: flex; align-items: center; gap: 12px; }
.dash-crypto__total {
  font-size: 0.875rem; font-weight: 700; color: var(--color-text);
  letter-spacing: -0.01em;
}
.dash-crypto__nw {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 16px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
}
.dash-crypto__nw-label {
  font-family: var(--font-display);
  font-size: 0.625rem; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--color-text-muted);
}
.dash-crypto__nw-val {
  font-size: 1rem; font-weight: 700; letter-spacing: -0.02em;
  color: var(--color-text);
}

/* ============================================================
   DUO — allocation + this month (flush cells)
   ============================================================ */
.dash-duo { grid-template-columns: 1fr 1fr; }
@media (max-width: 640px) { .dash-duo { grid-template-columns: 1fr; } }

.alloc-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--color-border-light);
}
.alloc-row:last-child { border-bottom: none; padding-bottom: 0; }
.alloc-row:first-child { padding-top: 0; }
.alloc-row__ring { flex-shrink: 0; }
.alloc-row__pct {
  width: 46px;
  font-family: var(--font-display);
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--color-text);
  flex-shrink: 0;
}
.alloc-row__name {
  flex: 1;
  font-size: 0.8125rem;
  color: var(--color-text);
  min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.alloc-row__amt {
  font-family: var(--font-display);
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: -0.03em;
  color: var(--color-text-muted);
  white-space: nowrap;
}

.month-rows { display: flex; flex-direction: column; }
.month-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--color-border-light);
}
.month-row:last-child { border-bottom: none; padding-bottom: 0; }
.month-row:first-child { padding-top: 0; }
.month-row__label { font-size: 0.8125rem; font-weight: 500; color: var(--color-text); }
.month-row__sub   { font-size: 0.6875rem; color: var(--color-text-muted); }
.month-row__value {
  font-family: var(--font-display);
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--color-text);
  white-space: nowrap;
}
.month-row__value--income  { color: var(--color-income); }
.month-row__value--expense { color: var(--color-expense); }

/* ============================================================
   CHARTS + FEED
   ============================================================ */
.chart-container--hero { height: 250px; }

/* Transactions feed grows to fill the right column so the Monthly overview
   below it lines up with the bottom of the left column's last card. */
.dash-feed { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.dash-feed .term__body { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.dash-feed .transaction-list {
  flex: 1 1 0;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--color-border) transparent;
}
@media (max-width: 768px) {
  /* single column: don't force the feed to grow */
  .dash-feed { flex: 0 1 auto; }
  .dash-feed .transaction-list { max-height: 392px; }
}
.dash-feed .transaction-list::-webkit-scrollbar { width: 4px; }
.dash-feed .transaction-list::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: 0; }

/* ============================================================
   QUICK-LOG HOURS — fast shift logging in the right column
   ============================================================ */
.dash-quicklog { flex: 0 0 auto; }
.dash-quicklog .term__body { display: flex; flex-direction: column; gap: 9px; }

/* day-of-week chips (current week) */
.ql-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.ql-day {
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  padding: 6px 0; cursor: pointer; min-width: 0;
  background: var(--color-surface-2); border: 1px solid var(--color-border);
  color: var(--color-text-muted);
  transition: color var(--transition), border-color var(--transition), background var(--transition);
}
.ql-day:hover:not(.ql-day--disabled) { color: var(--color-text); border-color: var(--color-text-muted); }
.ql-day.selected { color: #fff; border-color: var(--color-primary); background: var(--color-primary-light); }
.ql-day--disabled { opacity: 0.35; cursor: default; }
.ql-day__dow { font-size: 0.5625rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.ql-day__num { font-family: var(--font-display); font-size: 0.8125rem; font-weight: 600; }

/* compact hours/times toggle, sharing the action row with the Log button */
.quicklog__form { display: flex; flex-direction: column; gap: 7px; }
.ql-input-row { display: flex; align-items: center; gap: 6px; }
.ql-input-row .form-control { flex: 1; min-width: 0; padding: 8px 10px; font-size: 0.8125rem; }
.ql-sep { color: var(--color-text-muted); flex-shrink: 0; }
.ql-prefix { color: var(--color-text-muted); font-family: var(--font-display); flex-shrink: 0; }
.ql-actions { display: flex; align-items: stretch; gap: 6px; }
.ql-mode { flex: 0 0 auto; }
.ql-mode .seg-btn { padding: 7px 10px; }
.ql-actions .btn { flex: 1; justify-content: center; white-space: nowrap; }

.quicklog__rate { font-size: 0.75rem; color: var(--color-text-muted); }
.quicklog__rate strong { color: var(--color-text); font-family: var(--font-display); font-weight: 600; }
.quicklog__rate a { color: var(--color-text); }
.quicklog__stat { font-size: 0.75rem; color: var(--color-text-muted); }
.quicklog__stat strong { color: var(--color-text); font-family: var(--font-display); font-weight: 600; }

@media (max-width: 768px) {
  .chart-container--hero { height: 190px; }
}

/* ============================================================
   SPENDING PAGE — period bar
   ============================================================ */
.spending-period-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 0;
  padding: 12px 20px;
}
.spending-summary-chips {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
/* Range switcher (Week/Month/Year/All) + period arrows */
.period-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
#rangeToggle .seg-btn { padding: 7px 13px; }

/* Spending / Income segmented toggle */
.seg-toggle {
  display: inline-flex;
  border: 1px solid var(--color-border);
  align-self: flex-start;
}
.seg-btn {
  padding: 9px 20px;
  font-family: var(--font-display);
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--color-text-muted);
  background: var(--color-surface);
  border: none;
  border-right: 1px solid var(--color-border);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}
.seg-btn:last-child { border-right: none; }
.seg-btn:hover { color: var(--color-text); }
.seg-btn.active { background: #ffffff; color: #0a0a0a; }

/* Spending/Income: donut + ranked breakdown in one balanced panel */
.cat-overview__body {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 24px;
  align-items: center;
}
.cat-overview__donut { height: 230px; }
.cat-overview__list { width: 100%; }
@media (max-width: 700px) {
  .cat-overview__body { grid-template-columns: 1fr; gap: 16px; }
}

/* legacy two-up (kept harmless) */
.dashboard-hero {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 10px;
  align-items: start;
}
@media (max-width: 900px) { .dashboard-hero { grid-template-columns: 1fr; } }

/* Inline stat chips (spending period bar) */
.hero-stat-chip { display: inline-flex; align-items: baseline; gap: 5px; }
.hero-stat-chip__label {
  font-family: var(--font-display);
  font-size: 0.625rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--color-text-muted);
}
.hero-stat-chip__value {
  font-family: var(--font-display);
  font-size: 0.875rem; font-weight: 600;
  letter-spacing: -0.03em; color: var(--color-text);
}
.hero-stat-chip__sep { color: var(--color-text-light); font-size: 0.75rem; }

/* ============================================================
   MONTH NAV (prev / label / next)
   ============================================================ */
.month-nav { display: flex; align-items: center; gap: 8px; }
.month-nav__label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-text);
  min-width: 84px;
  text-align: center;
  white-space: nowrap;
}

/* ============================================================
   CARD SUBTITLE
   ============================================================ */
.card-title-sub {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  font-weight: 400;
}

/* ============================================================
   SPENDING BREAKDOWN
   ============================================================ */
.spending-breakdown-card { padding: 20px; display: flex; flex-direction: column; }
.spending-breakdown { display: flex; flex-direction: column; gap: 12px; margin-top: 4px; }
.spending-item { display: flex; align-items: center; gap: 12px; }
.spending-item__icon { font-size: 1.25rem; width: 32px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; color: var(--color-text-muted); }
.spending-item__info { flex: 1; min-width: 0; }
.spending-item__name {
  font-size: 0.8125rem; font-weight: 500; color: var(--color-text);
  margin-bottom: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.spending-item__bar-wrap { height: 6px; background: var(--color-surface-2); border-radius: 0; overflow: hidden; }
.spending-item__bar { height: 100%; border-radius: 0; transition: width 0.4s ease; min-width: 2px; }
.spending-item__meta { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; flex-shrink: 0; }
.spending-item__amount { font-size: 0.875rem; font-weight: 600; color: var(--color-expense); }
.spending-item__pct { font-size: 0.6875rem; color: var(--color-text-muted); }

/* ============================================================
   SUMMARY CARDS (money pages)
   ============================================================ */
.summary-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.summary-card {
  padding: 18px 20px;
  cursor: default;
  border-radius: 0;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  position: relative;
  overflow: hidden;
}
.summary-card--income  { border-top: 2px solid var(--color-income); }
.summary-card--expense { border-top: 2px solid var(--color-expense); }
.summary-card--savings { border-top: 2px solid var(--color-transfer); }
.summary-card--balance { border-top: 2px solid var(--color-text-light); }

.summary-card__icon {
  width: 30px; height: 30px;
  border-radius: 0;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 12px;
  line-height: 0;
}
.summary-card--balance .summary-card__icon { background: rgba(255,255,255,.08); color: var(--color-text); }
.summary-card--income  .summary-card__icon { background: rgba(0,209,143,.16);  color: var(--color-income); }
.summary-card--expense .summary-card__icon { background: rgba(255,92,122,.16); color: var(--color-expense); }
.summary-card--savings .summary-card__icon { background: rgba(212,166,74,.16); color: var(--color-transfer); }

.summary-card__label {
  font-family: var(--font-display);
  font-size: 0.625rem;
  font-weight: 600;
  color: var(--color-text-muted);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
.summary-card__amount {
  font-family: var(--font-display);
  font-size: 1.625rem;
  font-weight: 600;
  line-height: 1;
  margin-bottom: 8px;
  letter-spacing: -0.04em;
}
.summary-card--balance .summary-card__amount { color: var(--color-text); }
.summary-card--income  .summary-card__amount { color: var(--color-income); }
.summary-card--expense .summary-card__amount { color: var(--color-expense); }
.summary-card--savings .summary-card__amount { color: var(--color-transfer); }
.summary-card__sub { font-size: 0.75rem; color: var(--color-text-muted); font-weight: 500; }

/* Charts */
.charts-row { display: grid; grid-template-columns: 1fr 300px; gap: 10px; }
.chart-card        { padding: 20px; }
.chart-card--full  { width: 100%; }
.chart-container   { position: relative; height: 210px; width: 100%; }
.chart-container--donut { height: 210px; }
.chart-container canvas { display: block; width: 100%; height: 100%; }

.chart-empty {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  text-align: center; padding: 16px;
  color: var(--color-text-muted); font-size: 0.8125rem;
}
.chart-empty[hidden] { display: none; }
.chart-empty__inner { display: flex; flex-direction: column; align-items: center; gap: 2px; }

.chart-skeleton {
  position: absolute; inset: 0;
  display: flex; align-items: flex-end; justify-content: center;
  gap: 8px; padding: 12px 16px 28px;
}
.chart-skeleton[hidden] { display: none; }
.chart-skeleton__bar {
  flex: 1; border-radius: 0;
  background: var(--color-surface-2);
  animation: skeletonPulse 1.4s ease-in-out infinite;
}
.chart-skeleton__bar:nth-child(2) { animation-delay: 0.1s; }
.chart-skeleton__bar:nth-child(3) { animation-delay: 0.2s; }
.chart-skeleton__bar:nth-child(4) { animation-delay: 0.3s; }
.chart-skeleton__bar:nth-child(5) { animation-delay: 0.4s; }
.chart-skeleton__bar:nth-child(6) { animation-delay: 0.5s; }
@keyframes skeletonPulse { 0%, 100% { opacity: 0.4; } 50% { opacity: 0.8; } }
@media (prefers-reduced-motion: reduce) { .chart-skeleton__bar { animation: none; opacity: 0.5; } }

.legend            { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.legend-item       { display: flex; align-items: center; justify-content: space-between; font-size: 0.8125rem; gap: 8px; }
.legend-dot        { width: 8px; height: 8px; border-radius: 0; flex-shrink: 0; }
.legend-label      { flex: 1; color: var(--color-text); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legend-amount     { color: var(--color-text-muted); font-weight: 500; white-space: nowrap; font-size: 0.8125rem; }

.monthly-summary-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding-top: 14px;
  border-top: 1px solid var(--color-border);
  margin-top: 14px;
}
.monthly-summary-item { display: flex; flex-direction: column; gap: 3px; }
.monthly-summary-label {
  font-family: var(--font-display);
  font-size: 0.625rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--color-text-muted);
}
.monthly-summary-value { font-family: var(--font-display); font-size: 0.9375rem; font-weight: 600; letter-spacing: -0.03em; color: var(--color-text); }
.monthly-summary-item--income .monthly-summary-value { color: var(--color-income); }
.monthly-summary-item--expense .monthly-summary-value { color: var(--color-expense); }

/* Definite height so the canvas's height:100% resolves — with only flex/auto
   the canvas falls back to its 2:1 intrinsic ratio and overflows the card. */
.chart-container--sm { position: relative; height: 220px; width: 100%; }
.chart-container--sm canvas { display: block; width: 100%; height: 100%; }

.bottom-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

@media (max-width: 1200px) {
  .summary-cards { grid-template-columns: repeat(2, 1fr); }
  .charts-row    { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .summary-cards { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .summary-card__amount { font-size: 1.375rem; }
  .charts-row { grid-template-columns: 1fr; }
  .bottom-row { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .summary-card { padding: 14px 16px; }
  .summary-card__amount { font-size: 1.2rem; }
}

/* ── Cash-flow forecast card (dashboard, Phase 1) ───────────── */
.forecast-horizon { font-size: 0.75rem; color: var(--color-text-muted); }
.forecast-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px; margin-bottom: 14px; flex-wrap: wrap;
}
.forecast-stat__label { font-size: 0.75rem; color: var(--color-text-muted); margin-bottom: 2px; }
.forecast-stat__value { font-size: 1.5rem; font-weight: 600; color: var(--color-text); line-height: 1.1; }
.forecast-stat__sub { font-size: 0.8125rem; font-weight: 500; margin-top: 2px; }
.forecast-warning {
  font-size: 0.8125rem; line-height: 1.45; max-width: 320px;
  padding: 8px 11px; border: 1px solid var(--color-border);
  border-left-width: 3px; color: var(--color-text-muted);
}
.forecast-warning strong { color: var(--color-text); }
.forecast-warning--danger  { border-left-color: var(--color-expense);  color: var(--color-text); }
.forecast-warning--caution { border-left-color: var(--color-transfer); }
.forecast-basis { font-size: 0.6875rem; color: var(--color-text-light); margin-top: 10px; }

.crypto-range-btn { font-family: var(--font-display); font-size: 0.6875rem; min-width: 46px; padding: 4px 9px; }

/* ============================================================
   NET-WORTH GOAL — progress ring toward a target
   ============================================================ */
.nw-goal__display { display: flex; align-items: center; gap: 16px; }
.nw-goal__ring { flex-shrink: 0; width: 54px; height: 54px; line-height: 0; }
.nw-goal__ring svg { width: 54px; height: 54px; }
.nw-goal__info { min-width: 0; }
.nw-goal__pct { font-size: 1.75rem; font-weight: 600; color: #ffffff; letter-spacing: -0.04em; line-height: 1; }
.nw-goal__detail { font-size: 0.8125rem; color: var(--color-text); margin-top: 3px; }
.nw-goal__of { color: var(--color-text-muted); }
.nw-goal__pace { font-size: 0.75rem; margin-top: 4px; color: var(--color-text-muted); }
.nw-goal__pace--up { color: var(--color-income); }
.nw-goal__input-row { display: flex; align-items: center; gap: 8px; }
.nw-goal__input-row .form-control { flex: 1; }
.nw-goal__actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }

/* ============================================================
   UPCOMING BILLS — next recurring charges
   ============================================================ */
.bill-row { display: flex; align-items: center; gap: 11px; padding: 9px 4px; border-bottom: 1px solid var(--color-border-light); }
.bill-row:last-child { border-bottom: none; }
.bill-row__dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; background: var(--dot, var(--color-text-muted)); }
.bill-row__id { flex: 1; min-width: 0; }
.bill-row__name { font-size: 0.8125rem; color: var(--color-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bill-row__due { font-size: 0.6875rem; color: var(--color-text-muted); margin-top: 1px; }
.bill-row__due--over { color: var(--color-expense); }
.bill-row__amt { font-size: 0.875rem; font-weight: 600; color: var(--color-text); flex-shrink: 0; }
.bills-foot {
  display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
  padding: 10px 4px 4px; margin-top: 4px;
  border-top: 1px solid var(--color-border);
  font-family: var(--font-display); font-size: 0.6875rem; color: var(--color-text-muted);
}
.bills-foot__sep { opacity: 0.5; }

/* ── First-run card (empty account, dashboard) ──────────────── */
.first-run { margin-bottom: 20px; padding: 20px; }
.first-run__head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; margin-bottom: 16px;
}
.first-run__title { font-size: 1.25rem; font-weight: 700; margin: 4px 0 6px; }
.first-run__sub { font-size: 0.8125rem; color: var(--color-text-muted); margin: 0; max-width: 52ch; }
.first-run__steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 1px; background: var(--color-border); }
.first-run__step {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px; background: var(--color-surface);
  color: var(--color-text); text-decoration: none;
  transition: background 120ms ease;
}
.first-run__step:hover { background: var(--color-primary-light); }
.first-run__num { font-size: 0.75rem; color: var(--color-text-light); letter-spacing: 0.08em; }
.first-run__step-body { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.first-run__step-body strong { font-size: 0.875rem; font-weight: 600; }
.first-run__step-body span { font-size: 0.75rem; color: var(--color-text-muted); }
.first-run__arrow { color: var(--color-text-light); font-family: var(--font-display); }
.first-run__step:hover .first-run__arrow { color: var(--color-primary); }
@media (max-width: 480px) {
  .first-run { padding: 16px 14px; }
  .first-run__head { flex-direction: column; gap: 10px; }
}
