/* Parcel — Money (SPEC-v2 §5). Owned by the money screen builder. Scoped under .view-money (the page) and .money-sheet (the shared
   sheets, which are overlays). The layout follows the width of the content column (container "mny"), not the viewport:
   < 760px one column (tiles 2 × 2, coming up as a list) · ≥ 760px tiles 4 across, coming up as columns, safe to withdraw beside its working. */

.view-money .mny { container: mny / inline-size; min-width: 0; }
.view-money .mny-intro {
  margin-top: var(--sp-2); padding: 0 var(--sp-1);
  font-size: var(--fs-subhead); line-height: var(--lh-subhead); color: var(--label-2); text-wrap: pretty;
}
.view-money .mny > .section > .section-header { flex-wrap: wrap; row-gap: 2px; }
.view-money .mny-aside { font-size: var(--fs-footnote); line-height: var(--lh-footnote); color: var(--label-2); }
.view-money .mny-section-note {
  margin-top: 10px; padding: 0 var(--sp-1);
  font-size: var(--fs-footnote); line-height: var(--lh-footnote); color: var(--label-2); text-wrap: pretty;
}
.view-money .mny-timeline-card .mny-section-note { padding: 0; margin-top: 4px; margin-bottom: 8px; }
.view-money .mny-foot {
  margin-top: var(--sp-7); padding: 0 var(--sp-1);
  font-size: var(--fs-footnote); line-height: var(--lh-footnote); color: var(--label-2); text-wrap: pretty;
}
.view-money .mny-empty { padding-top: var(--sp-6); }
.view-money .mny-none p { font-size: var(--fs-subhead); line-height: var(--lh-subhead); color: var(--label-2); }

/* ---------------------------------------------------------------- alerts */
.view-money .mny-alerts { display: flex; flex-direction: column; gap: 12px; }
.view-money .mny-alert {
  display: grid; grid-template-columns: 36px minmax(0, 1fr); column-gap: 14px;
  padding: 16px 16px 14px;
  border-radius: var(--r-card);
  background: color-mix(in srgb, var(--tone) 9%, var(--bg-2));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--tone) 22%, transparent);
}
.view-money .mny-alert-icon {
  width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center;
  color: var(--tone); background: color-mix(in srgb, var(--tone) 16%, transparent);
  --knockout: var(--bg-2);
}
.view-money .mny-alert-title { font-size: var(--fs-headline); line-height: var(--lh-headline); font-weight: var(--w-semibold); padding-top: 6px; }
.view-money .mny-alert-text { margin-top: 2px; font-size: var(--fs-subhead); line-height: var(--lh-subhead); color: var(--label); text-wrap: pretty; }
.view-money .mny-alert-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 14px; }
.view-money .mny-alert-note { margin-top: 10px; font-size: var(--fs-footnote); line-height: var(--lh-footnote); color: var(--label-2); text-wrap: pretty; }
@container mny (max-width: 459.98px) {
  .view-money .mny-alert { grid-template-columns: 30px minmax(0, 1fr); column-gap: 12px; }
  .view-money .mny-alert-icon { width: 30px; height: 30px; }
  .view-money .mny-alert-icon svg { width: 17px; height: 17px; }
  .view-money .mny-alert-title { padding-top: 3px; }
  .view-money .mny-alert-actions .money-onetap { width: 100%; }
}

/* ---------------------------------------------------------------- balances */
.view-money .mny-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@container mny (min-width: 760px) { .view-money .mny-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; } }
.view-money .mny-tile {
  display: flex; flex-direction: column;
  min-width: 0;
  padding: 13px 15px 14px;
  border-radius: 16px;
  background: var(--bg-2);
  /* The value fits the tile's own width (never cut off with "…", V009). */
  container: mnytile / inline-size;
}
.view-money .mny-tile-label {
  display: flex; align-items: flex-start; gap: 5px; min-height: 18px;
  font-size: 13px; line-height: 18px; font-weight: var(--w-semibold);
}
.view-money .mny-tile-label[class*="tone-"] { color: var(--tone-text); }
.view-money .mny-tile-label svg { color: var(--tone); flex: none; margin-top: 1.5px; }
.view-money .mny-tile-label span { min-width: 0; text-wrap: balance; }
.view-money .mny-tile-value {
  margin-top: 4px;
  font-family: var(--font-rounded); font-weight: var(--w-bold); letter-spacing: -0.5px;
  /* 26px (28 with room), shrinking for a long amount so "US$1,486.07" always fits whole (--len = its characters). */
  font-size: min(26px, calc(100cqi / (var(--len, 9) * .6))); line-height: 32px;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
@container mny (min-width: 760px) { .view-money .mny-tile-value { font-size: min(28px, calc(100cqi / (var(--len, 9) * .6))); line-height: 34px; } }
/* Small phones (320): one tile per row, the value with its sub-line beside it, so nothing has to shrink or wrap. */
@container mny (max-width: 339.98px) {
  .view-money .mny-tiles { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .view-money .mny-tile { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 8px; align-items: baseline; padding: 12px 14px 13px; }
  .view-money .mny-tile > :not(.mny-tile-value, .mny-tile-sub) { grid-column: 1 / -1; }
  .view-money .mny-tile-value { font-size: min(24px, calc(100cqi / (var(--len, 9) * .6))); line-height: 30px; }
  .view-money .mny-tile-sub { margin-bottom: 10px; }
  .view-money .mny-tile > .mny-gauge { margin-top: 0; }
  .view-money .mny-tile > .mny-gauge.is-blank { display: none; }
  .view-money .mny-tile-foot { margin-top: 6px; }
  .view-money .mny-tile.is-skeleton { display: flex; min-height: 96px; }
}
.view-money .mny-tile-sub { font-size: 13px; line-height: 18px; color: var(--label-2); text-wrap: pretty; }
.view-money .mny-gauge {
  position: relative; display: block; flex: none;
  height: 6px; margin: auto 0 0; transform: translateY(-1px);
  border-radius: 3px; background: var(--fill-3);
}
.view-money .mny-tile > .mny-gauge { margin-top: auto; }
.view-money .mny-gauge.is-blank { background: transparent; }
.view-money .mny-gauge-fill { position: absolute; inset: 0 auto 0 0; border-radius: 3px; background: var(--tone, var(--accent)); min-width: 6px; }
.view-money .mny-gauge-fill.is-zero { min-width: 0; }
.view-money .mny-gauge-tick {
  position: absolute; top: -3px; bottom: -3px; width: 2px; margin-left: -1px;
  border-radius: 1px; background: var(--label-2);
  box-shadow: 0 0 0 1.5px var(--bg-2);
}
.view-money .mny-tile-foot { margin-top: 8px; font-size: 13px; line-height: 18px; color: var(--label-2); text-wrap: pretty; }
.view-money .mny-tile-foot.is-warn { color: var(--orange-text); font-weight: var(--w-semibold); }
/* The space above the gauge: tiles share a row height, so the gauges and the lines under them line up across the row. */
.view-money .mny-tile-sub { margin-bottom: 12px; }

/* ---------------------------------------------------------------- coming up */
.view-money .mny-up-list { background: var(--bg-2); border-radius: var(--r-card); overflow: hidden; }
.view-money .mny-up { display: grid; grid-template-columns: 84px minmax(0, 1fr); column-gap: 12px; padding: 14px 16px; position: relative; }
.view-money .mny-up + .mny-up::before {
  content: ''; position: absolute; top: 0; left: 16px; right: 0; height: var(--hairline); background: var(--sep);
}
.view-money .mny-up-when { padding-top: 5px; font-size: var(--fs-footnote); line-height: var(--lh-footnote); font-weight: var(--w-semibold); color: var(--label-2); }
.view-money .mny-up-body { display: grid; grid-template-columns: 30px minmax(0, 1fr); column-gap: 12px; align-items: start; min-width: 0; }
.view-money .mny-up-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.view-money .mny-up-title { font-size: var(--fs-callout); line-height: 21px; font-weight: var(--w-semibold); min-width: 0; padding-top: 4px; }
.view-money .mny-up-amount { font-size: var(--fs-callout); line-height: 21px; font-weight: var(--w-semibold); font-variant-numeric: tabular-nums; white-space: nowrap; }
.view-money .mny-up-amount.is-in { color: var(--green-text); }
.view-money .mny-up-detail { margin-top: 2px; font-size: var(--fs-footnote); line-height: var(--lh-footnote); color: var(--label-2); text-wrap: pretty; }
.view-money .mny-up-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; }
.view-money .mny-up-actions .btn { max-width: 100%; }
@container mny (max-width: 459.98px) {
  .view-money .mny-up { grid-template-columns: minmax(0, 1fr); row-gap: 8px; }
  .view-money .mny-up-when { padding-top: 0; }
}
@container mny (min-width: 760px) {
  .view-money .mny-up-list.has-2, .view-money .mny-up-list.has-3 { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
  .view-money .mny-up-list.has-2 .mny-up, .view-money .mny-up-list.has-3 .mny-up { grid-template-columns: minmax(0, 1fr); row-gap: 10px; padding: 16px 20px 18px; align-content: start; }
  .view-money .mny-up-list.has-2 .mny-up + .mny-up::before, .view-money .mny-up-list.has-3 .mny-up + .mny-up::before {
    top: 16px; bottom: 16px; left: 0; right: auto; width: var(--hairline); height: auto;
  }
  .view-money .mny-up-list.has-2 .mny-up-when, .view-money .mny-up-list.has-3 .mny-up-when { padding-top: 0; }
  /* As columns, the amount gets its own line under the title, a little larger. */
  .view-money .mny-up-list.has-2 .mny-up-head, .view-money .mny-up-list.has-3 .mny-up-head { flex-direction: column; align-items: flex-start; gap: 0; }
  .view-money .mny-up-list.has-2 .mny-up-amount, .view-money .mny-up-list.has-3 .mny-up-amount {
    font-family: var(--font-rounded); font-size: 20px; line-height: 26px; font-weight: var(--w-bold); letter-spacing: -0.3px;
  }
}

/* ---------------------------------------------------------------- safe to withdraw */
.view-money .mny-safe { display: grid; grid-template-columns: minmax(0, 1fr); row-gap: 24px; padding: 18px 16px 20px; }
@container mny (min-width: 760px) {
  .view-money .mny-safe { padding: 24px; }
  .view-money .mny-safe.has-working { grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); column-gap: 40px; align-items: start; }
  /* The amount stays in view while you read down its working. */
  .view-money .mny-safe.has-working .mny-safe-main { position: sticky; top: calc(var(--navbar-h) + var(--safe-top, 0px) + 20px); }
}
.view-money .mny-safe-main { min-width: 0; }
.view-money .mny-safe-label {
  display: flex; align-items: center; gap: 6px;
  font-size: var(--fs-subhead); line-height: var(--lh-subhead); font-weight: var(--w-semibold);
  color: var(--green-text);
}
.view-money .mny-safe-label svg { color: var(--green); flex: none; }
.view-money .mny-safe-main { container: mnysafe / inline-size; }
.view-money .mny-safe-amount {
  margin-top: 4px;
  font-family: var(--font-rounded); font-size: min(var(--fs-hero, 48px), calc(100cqi / (var(--len, 6) * .58))); line-height: 1.08; font-weight: var(--w-bold); letter-spacing: -1px;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.view-money .mny-safe-amount.is-pos { color: var(--green-text); }
.view-money .mny-safe-text { margin-top: 6px; font-size: var(--fs-callout); line-height: 22px; color: var(--label); text-wrap: pretty; }
.view-money .mny-safe-when {
  display: flex; align-items: flex-start; gap: 8px;
  margin-top: 12px; padding: 10px 12px;
  border-radius: var(--r-lg);
  background: var(--fill-4);
  font-size: var(--fs-subhead); line-height: var(--lh-subhead); color: var(--label); text-wrap: pretty;
}
.view-money .mny-safe-when svg { flex: none; margin-top: 2px; color: var(--label-2); }
.view-money .mny-safe-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-top: 16px; }
.view-money .mny-safe-taken { font-size: var(--fs-footnote); line-height: var(--lh-footnote); color: var(--label-2); }
.view-money .mny-safe-how { margin-top: 16px; font-size: var(--fs-footnote); line-height: var(--lh-footnote); color: var(--label-2); text-wrap: pretty; }

.view-money .mny-working { min-width: 0; }
@container mny (max-width: 759.98px) {
  .view-money .mny-working { padding-top: 20px; box-shadow: inset 0 var(--hairline) 0 var(--sep); }
}
.view-money .mny-working-title { font-size: var(--fs-headline); line-height: var(--lh-headline); font-weight: var(--w-semibold); }
.view-money .mny-group { margin-top: 14px; }
.view-money .mny-group-title {
  margin-bottom: 2px;
  font-size: var(--fs-footnote); line-height: var(--lh-footnote); font-weight: var(--w-semibold); color: var(--label-2);
}
.view-money .mny-lines { margin: 0; padding: 0; list-style: none; }
.view-money .mny-line { display: flex; align-items: baseline; gap: 16px; padding: 8px 0; position: relative; }
.view-money .mny-line + .mny-line::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: var(--hairline); background: var(--sep); }
.view-money .mny-line-text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.view-money .mny-line-title { font-size: var(--fs-subhead); line-height: 20px; }
.view-money .mny-line-note { font-size: var(--fs-footnote); line-height: var(--lh-footnote); color: var(--label-2); text-wrap: pretty; }
.view-money .mny-line-amount { flex: none; font-size: var(--fs-subhead); line-height: 20px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.view-money .mny-line.is-zero .mny-line-title, .view-money .mny-line.is-zero .mny-line-amount { color: var(--label-2); }
/* The bank group's subtotal: the store's money actually in your bank. */
.view-money .mny-line.is-subtotal .mny-line-title, .view-money .mny-line.is-subtotal .mny-line-amount { font-weight: var(--w-semibold); color: var(--label); }
.view-money .mny-line.is-subtotal::before { background: var(--label-3); }
.view-money .mny-group + .mny-group { margin-top: 18px; }
.view-money .mny-total { margin-top: 10px; padding-top: 2px; border-top: 1.5px solid var(--label); }
.view-money .mny-total .mny-line-title, .view-money .mny-total .mny-line-amount { font-weight: var(--w-semibold); }
.view-money .mny-line.is-result .mny-line-title, .view-money .mny-line.is-result .mny-line-amount { font-size: var(--fs-headline); line-height: var(--lh-headline); }

/* ---------------------------------------------------------------- last 30 days */
.view-money .mny-timeline-card { padding: 16px 16px 8px; }
@container mny (min-width: 760px) { .view-money .mny-timeline-card { padding: 20px 20px 10px; } }
.view-money .mny-totals { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.view-money .mny-total-item { min-width: 0; }
.view-money .mny-total-item + .mny-total-item { padding-left: 12px; box-shadow: inset var(--hairline) 0 0 var(--sep); }
.view-money .mny-total-label { font-size: 13px; line-height: 18px; font-weight: var(--w-semibold); color: var(--label-2); }
/* Each total fits its own column whole (--len = its characters), never "…". */
.view-money .mny-total-value { container-type: inline-size; }
.view-money .mny-total-value > span {
  display: block;
  font-family: var(--font-rounded); font-size: min(20px, calc(100cqi / (var(--len, 9) * .6))); line-height: 25px; font-weight: var(--w-bold); letter-spacing: -0.3px;
  white-space: nowrap; font-variant-numeric: tabular-nums;
}
/* Phones: In and Out side by side, Net on its own line under them (three across would cut the numbers off). */
@container mny (max-width: 459.98px) {
  .view-money .mny-totals { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 10px; }
  .view-money .mny-total-item.is-net-pos, .view-money .mny-total-item.is-net-neg {
    grid-column: 1 / -1; padding-left: 0; padding-top: 10px; box-shadow: inset 0 var(--hairline) 0 var(--sep);
  }
}
.view-money .mny-total-item.is-in .mny-total-value, .view-money .mny-total-item.is-net-pos .mny-total-value { color: var(--green-text); }
.view-money .mny-total-item.is-net-neg .mny-total-value { color: var(--red-text); }
.view-money .mny-chart { margin-top: 18px; }
.view-money .mny-chart-note { margin-top: 6px; font-size: var(--fs-caption); line-height: 16px; color: var(--label-2); }
.view-money .mny-flows { margin-top: 8px; }
.view-money .mny-day-title {
  padding: 16px 0 4px;
  font-size: var(--fs-footnote); line-height: var(--lh-footnote); font-weight: var(--w-semibold); color: var(--label-2);
}
.view-money .mny-flow-list { margin: 0 -16px; padding: 0; list-style: none; }
@container mny (min-width: 760px) { .view-money .mny-flow-list { margin-inline: -20px; } }
.view-money .mny-flow-li { position: relative; }
.view-money .mny-flow-li + .mny-flow-li::before {
  content: ''; position: absolute; top: 0; left: calc(16px + 42px); right: 0; height: var(--hairline); background: var(--sep); z-index: 1;
}
.view-money .mny-flow {
  display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; column-gap: 12px; align-items: center;
  min-height: 52px; padding: 8px 16px;
  color: inherit;
}
@container mny (min-width: 760px) {
  .view-money .mny-flow { padding-inline: 20px; }
  .view-money .mny-flow-li + .mny-flow-li::before { left: calc(20px + 42px); }
}
.view-money .mny-flow.is-link { grid-template-columns: 30px minmax(0, 1fr) auto 14px; }
.view-money .mny-flow.is-link:active { background: var(--highlight, var(--fill-3)); }
@media (hover: hover) and (pointer: fine) { .view-money .mny-flow.is-link:hover { background: var(--fill-4); } }
.view-money .mny-flow-text { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.view-money .mny-flow-title { font-size: var(--fs-subhead); line-height: 20px; }
.view-money .mny-flow-detail { font-size: var(--fs-footnote); line-height: var(--lh-footnote); color: var(--label-2); text-wrap: pretty; }
.view-money .mny-flow-right { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; }
.view-money .mny-flow-amount { font-size: var(--fs-subhead); line-height: 20px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.view-money .mny-flow-amount.is-in { color: var(--green-text); }
.view-money .mny-flow-amount.is-aside { color: var(--label-2); }
.view-money .mny-flow-tag { font-size: var(--fs-caption2, 11px); line-height: 13px; color: var(--label-2); white-space: nowrap; }
.view-money .mny-flow-chev { color: var(--label-3); }
.view-money .mny-more-wrap { display: flex; justify-content: center; padding: 6px 0 4px; }
.view-money .mny-more {
  min-height: 44px; padding: 0 12px;
  font: inherit; font-size: var(--fs-subhead); color: var(--accent-text);
  background: none; border: 0; cursor: pointer;
}
.view-money .mny-more[hidden] { display: none; }
@media (hover: hover) and (pointer: fine) { .view-money .mny-more:hover { text-decoration: underline; text-underline-offset: 2px; } }

/* ---------------------------------------------------------------- skeleton */
.view-money .mny-tile.is-skeleton { min-height: 132px; }

/* ---------------------------------------------------------------- forced colours */
@media (forced-colors: active) {
  .view-money .mny-gauge { border: 1px solid CanvasText; background: Canvas; }
  .view-money .mny-gauge-fill { forced-color-adjust: none; background: Highlight; }
  .view-money .mny-gauge-tick { forced-color-adjust: none; background: CanvasText; }
  .view-money .mny-alert, .view-money .mny-tile, .view-money .mny-up-list, .view-money .mny-safe-when { border: 1px solid CanvasText; }
  .view-money .mny-total { border-top-color: CanvasText; }
}

/* ================================================================= shared sheets (overlays: not inside .view-money) */
.money-sheet .money-sheet-body { display: flex; flex-direction: column; gap: 16px; padding-bottom: 8px; }
.money-sheet .money-sheet-intro { font-size: var(--fs-subhead); line-height: var(--lh-subhead); color: var(--label); text-wrap: pretty; padding: 0 4px; }
.money-sheet .money-sheet-foot { font-size: var(--fs-footnote); line-height: var(--lh-footnote); color: var(--label-2); text-wrap: pretty; padding: 0 4px; }
.money-sheet .money-sheet-safe {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  padding: 12px 16px; border-radius: var(--r-list); background: var(--bg-2);
}
.money-sheet .money-sheet-safe-label { font-size: var(--fs-subhead); line-height: var(--lh-subhead); color: var(--label-2); }
.money-sheet .money-sheet-safe-value { font-family: var(--font-rounded); font-size: 20px; line-height: 25px; font-weight: var(--w-bold); font-variant-numeric: tabular-nums; }
.money-sheet .field-hint.is-warning { color: var(--orange-text); }
