/* =====================================================================
   Fund Balance card — Apple-design premium statement
   Same structure, same 420 px export width as before; restyled to match the
   web app's Apple design theme: grouped-background canvas -> white "grouped
   list" panels with hairline separators -> iOS gradient icon tiles ->
   a glossy deep-blue Grand Total hero.
   - On screen the card follows Light / Dark mode (variables below).
   - JPG / PNG export is ALWAYS light (export.js forces data-theme=light on the clone).
   IMPORTANT: no backdrop-filter / inset shadows / CSS filters / background-clip:text —
   html2canvas cannot draw them. Only gradients, borders and outer shadows are used, so
   the on-screen card and the exported image look identical.
   ===================================================================== */
.card.fbc {
  --fbc-ink: #1d1d1f;
  --fbc-mute: rgba(60, 60, 67, .62);
  --fbc-line: rgba(60, 60, 67, .13);
  --fbc-surface: #ffffff;
  --fbc-surface-edge: rgba(60, 60, 67, .10);
  --fbc-fill: rgba(120, 120, 128, .12);
  --fbc-brand: #203088;
  --fbc-red: #e01820;
  --fbc-total-tint: linear-gradient(90deg, rgba(255, 149, 0, .13) 0%, rgba(255, 149, 0, .06) 100%);
  --fbc-shadow: 0 1px 2px rgba(20, 30, 70, .05), 0 10px 26px rgba(30, 42, 100, .09);
  --fbc-canvas: linear-gradient(135deg, rgba(10, 132, 255, .07) 0%, rgba(10, 132, 255, 0) 38%), linear-gradient(180deg, #f6f6fa 0%, #e9e9f1 100%);
  --fbc-btn-bg: rgba(255, 255, 255, .82);
  --fbc-btn-ink: #0a6fe0;

  font-family: 'SF Pro Display', 'SF Pro Text', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased;
  color: var(--fbc-ink);
  background-color: #eeeef4;
  background-image: var(--fbc-canvas);
  border: 0; border-radius: 28px; box-shadow: 0 12px 34px rgba(20, 30, 70, .14);
  width: 100%; max-width: 420px; margin-left: auto; margin-right: auto;
  padding: 22px 16px 16px; overflow: visible;
}
[data-theme="dark"] .card.fbc:not(.fbc-export-theme) {
  --fbc-ink: #f5f5f7;
  --fbc-mute: rgba(235, 235, 245, .60);
  --fbc-line: rgba(120, 120, 128, .34);
  --fbc-surface: #1c1c1e;
  --fbc-surface-edge: rgba(255, 255, 255, .09);
  --fbc-fill: rgba(120, 120, 128, .26);
  --fbc-brand: #9db0ff;
  --fbc-total-tint: linear-gradient(90deg, rgba(255, 159, 10, .20) 0%, rgba(255, 159, 10, .09) 100%);
  --fbc-shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 10px 26px rgba(0, 0, 0, .45);
  --fbc-canvas: linear-gradient(135deg, rgba(10, 132, 255, .16) 0%, rgba(10, 132, 255, 0) 42%), linear-gradient(180deg, #121216 0%, #050507 100%);
  --fbc-btn-bg: rgba(60, 60, 67, .72);
  --fbc-btn-ink: #6cb2ff;
  box-shadow: 0 12px 34px rgba(0, 0, 0, .55);
}
.fbc, .fbc * { box-sizing: border-box; }

/* ---- Header ---- */
.fbc-head { display: flex; align-items: center; gap: 12px; padding: 0 6px 18px; }
.fbc-logo-plate { flex: none; display: inline-flex; align-items: center; align-self: center; }
.fbc-logo { display: block; height: 36px; width: auto; background: transparent; border: 0; border-radius: 0; box-shadow: none; padding: 0; object-fit: contain; }
.fbc-head-text { min-width: 0; flex: 1 1 auto; }
.fbc-kicker { font-size: 11.5px; font-weight: 700; letter-spacing: .9px; text-transform: uppercase; color: var(--fbc-red); margin-bottom: 3px; }
.fbc-name { margin: 0; font-size: 24px; line-height: 28px; font-weight: 700; letter-spacing: -.5px; color: var(--fbc-ink); overflow-wrap: anywhere; }
.fbc-export-btns { display: flex; gap: 6px; flex: none; align-self: flex-start; }
.fbc-btn {
  width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center;
  border: .5px solid var(--fbc-surface-edge); background: var(--fbc-btn-bg); color: var(--fbc-btn-ink);
  border-radius: 10px; font-size: 15px; cursor: pointer; box-shadow: 0 1px 3px rgba(20, 30, 70, .12);

}
.fbc-btn:hover { background: #007aff; color: #fff; }

.card.fbc .fbc-body { padding: 0; overflow: visible !important; }

/* ---- Grouped-list panels (Capital Adjustment, Fund Type, footer) ---- */
.fbc-panel, .fbc-foot {
  position: relative; overflow: hidden; margin-bottom: 12px; border-radius: 22px;
  background-color: var(--fbc-surface);
  border: .5px solid var(--fbc-surface-edge);
  box-shadow: var(--fbc-shadow);
}
.fbc-panel-head { display: flex; align-items: center; gap: 14px; padding: 16px 18px 8px; }

/* iOS gradient icon tiles (same colours as the dashboard KPI tiles) */
.fbc-tile {
  width: 36px; height: 36px; border-radius: 10px; flex: none; display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-size: 17px; line-height: 1;
}
.fbc-tile svg { width: 19px; height: 19px; display: block; }
.fbc-tile-lg svg { width: 20px; height: 20px; }
.fbc-tile-lg { width: 38px; height: 38px; border-radius: 11px; font-size: 20px; }
.fbc-panel-head .fbc-tile {
  background-color: #f08400; background-image: linear-gradient(180deg, rgba(255, 255, 255, .30) 0%, rgba(255, 255, 255, 0) 55%), linear-gradient(180deg, #ffad33 0%, #f08400 100%);
  box-shadow: 0 3px 8px rgba(240, 132, 0, .34);
}
.fbc-type > .fbc-tile {
  background-color: #8e44d4; background-image: linear-gradient(180deg, rgba(255, 255, 255, .30) 0%, rgba(255, 255, 255, 0) 55%), linear-gradient(180deg, #bf6ef0 0%, #8e44d4 100%);
  box-shadow: 0 3px 8px rgba(142, 68, 212, .34);
}
.fbc-tile-lg {
  background-color: #e5241d; background-image: linear-gradient(180deg, rgba(255, 255, 255, .28) 0%, rgba(255, 255, 255, 0) 55%), linear-gradient(180deg, #ff5a52 0%, #e01820 100%);
  box-shadow: 0 3px 8px rgba(224, 24, 32, .34);
}
.fbc-panel-title { font-size: 18px; font-weight: 600; letter-spacing: -.35px; color: var(--fbc-ink); }

/* Table */
.fbc-table { width: calc(100% - 36px); margin: 0 18px; border-collapse: collapse; border: 0; background: transparent; }
.fbc-table th, .fbc-table td { background: transparent !important; border: 0; vertical-align: middle; color: var(--fbc-ink); }
.fbc-table thead th { text-align: left; padding: 11px 0; font-size: 12px; font-weight: 600; letter-spacing: .5px; text-transform: uppercase; color: var(--fbc-mute); border-bottom: .5px solid var(--fbc-line); white-space: nowrap; }
.fbc-table thead th.fbc-c-sl { font-weight: 600; color: var(--fbc-mute); }
.fbc-table tbody td { padding: 11px 0; font-size: 18px; letter-spacing: -.3px; border-bottom: .5px solid var(--fbc-line); }
.fbc-table tbody tr:last-child td { border-bottom: 0; }
.fbc-c-sl { width: 48px; text-align: left !important; }
.fbc-c-amt { text-align: right !important; white-space: nowrap; }
.fbc-sl {
  width: 32px; height: 32px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center;
  background: var(--fbc-fill); color: var(--fbc-mute); font-size: 14px; font-weight: 600;
}
.fbc-entity { font-weight: 500; color: var(--fbc-ink) !important; }
.fbc-amt { font-weight: 600; color: var(--fbc-ink) !important; }
.fbc-empty { text-align: center; color: var(--fbc-mute) !important; padding: 20px 14px !important; font-size: 15px !important; }

.fbc-total-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 8px; padding: 17px 18px;
  background-image: var(--fbc-total-tint); border-top: .5px solid var(--fbc-line);
  font-size: 18px; font-weight: 500; letter-spacing: -.3px; color: var(--fbc-ink);
}
.fbc-total-row strong { font-weight: 700; white-space: nowrap; }

/* Fund Type */
.fbc-type { display: flex; align-items: center; gap: 14px; padding: 16px 18px; }
.fbc-type-text { flex: 1 1 auto; min-width: 0; }
.fbc-type-label { font-size: 13px; color: var(--fbc-mute); }
.fbc-type-name { font-size: 18px; font-weight: 600; letter-spacing: -.3px; color: var(--fbc-ink); overflow-wrap: anywhere; }
.fbc-type-sep { width: .5px; align-self: stretch; background: var(--fbc-line); flex: none; }
.fbc-type-bal { text-align: right; flex: none; }
.fbc-type-bal-label { font-size: 11.5px; font-weight: 600; letter-spacing: .6px; text-transform: uppercase; color: var(--fbc-mute); }
.fbc-type-bal-amt { font-size: 18px; font-weight: 600; letter-spacing: -.3px; white-space: nowrap; color: var(--fbc-ink); }

/* ---- Grand Total: glossy deep-blue hero ---- */
.fbc-grand {
  display: flex; flex-direction: column; align-items: stretch; gap: 12px;
  margin: 0 0 12px; padding: 20px 20px 22px; border-radius: 22px; color: #fff;
  background-color: #1b2a86;
  background-image:
    linear-gradient(180deg, rgba(255, 255, 255, .20) 0%, rgba(255, 255, 255, 0) 46%),
    linear-gradient(118deg, rgba(255, 255, 255, .09) 0%, rgba(255, 255, 255, 0) 42%),
    linear-gradient(155deg, #3c5fe0 0%, #26379b 46%, #121c5e 100%);
  border: .5px solid rgba(255, 255, 255, .28);
  box-shadow: 0 1px 2px rgba(15, 28, 90, .25), 0 14px 30px rgba(24, 40, 140, .34);
}
.fbc-grand-label { display: flex; align-items: center; gap: 12px; font-size: 18px; font-weight: 500; letter-spacing: -.3px; text-transform: none; color: rgba(255, 255, 255, .92); }
.fbc-grand-label svg { width: 26px; height: 26px; display: block; flex: none; color: #fff; }
.fbc-grand-amt { font-size: 34px; line-height: 40px; font-weight: 700; letter-spacing: -.4px; white-space: nowrap; text-align: right; color: #fff; }

/* ---- Footer panel: Balance Date | Submitted At ........ logo + brand ---- */
.fbc-foot { margin-bottom: 0; padding: 14px 14px 15px; }
.fbc-foot-row { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px 12px; }
.fbc-foot-left { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 0 1 auto; }
.fbc-foot-grid { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.fbc-foot-line { display: flex; align-items: stretch; gap: 0; }
.fbc-foot-item { display: flex; flex-direction: column; gap: 1px; white-space: nowrap; }
.fbc-foot-line .fbc-foot-item + .fbc-foot-item { margin-left: 10px; padding-left: 10px; border-left: .5px solid var(--fbc-line); }
.fbc-foot-label { font-size: 12.5px; font-weight: 400; letter-spacing: 0; text-transform: none; color: var(--fbc-mute); }
.fbc-foot-val { font-size: 14.5px; font-weight: 600; letter-spacing: -.3px; color: var(--fbc-ink); }
.fbc-foot-right { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; flex: none; margin-left: auto; }
.fbc-foot-logo { display: block; width: 50px; height: auto; }
.fbc-brand { margin: 0; text-align: right; font-size: 9.5px; font-weight: 600; letter-spacing: .3px; text-transform: uppercase; color: var(--fbc-brand); white-space: nowrap; }
.fbc-note { margin-top: 12px; padding-top: 10px; border-top: .5px dashed var(--fbc-line); font-size: 12px; font-style: italic; color: var(--fbc-mute); }
.fbc-note strong { color: var(--fbc-ink); font-weight: 600; }

/* Dark mode: the navy Walton mark needs a light plate to stay readable */
[data-theme="dark"] .card.fbc:not(.fbc-export-theme) .fbc-logo,
[data-theme="dark"] .card.fbc:not(.fbc-export-theme) .fbc-foot-logo { background: #fff; border-radius: 9px; padding: 4px 7px; }
[data-theme="dark"] .card.fbc:not(.fbc-export-theme) .fbc-foot-logo { box-sizing: content-box; width: 36px; }

/* ---- Narrow containers (Dashboard side panel is 300 px wide) ---- */
/* (excluded while exporting, so JPG/PNG are identical whichever page they are exported from) */
.dash-fb .card.fbc:not(.fbc-export-theme) .fbc-grand-amt { font-size: 27px; line-height: 34px; }
.dash-fb .card.fbc:not(.fbc-export-theme) .fbc-table thead th { font-size: 10.5px; letter-spacing: .2px; }
.dash-fb .card.fbc:not(.fbc-export-theme) .fbc-table tbody td,
.dash-fb .card.fbc:not(.fbc-export-theme) .fbc-total-row,
.dash-fb .card.fbc:not(.fbc-export-theme) .fbc-type-name,
.dash-fb .card.fbc:not(.fbc-export-theme) .fbc-type-bal-amt { font-size: 16px; }
/* Fund Type panel on phones: slightly smaller type so name + balance sit side by side; below ~380 px (and in the
   300 px Dashboard panel) the balance drops under the name instead of breaking "Miscellaneous" mid-word.
   Never applied to the export (it is always laid out at 420 px). */
.card.fbc:not(.fbc-export-theme) .fbc-type-name { overflow-wrap: normal; }
@media (max-width: 480px) {
  .card.fbc:not(.fbc-export-theme) .fbc-type { gap: 10px; padding: 14px; }
  .card.fbc:not(.fbc-export-theme) .fbc-type-name,
  .card.fbc:not(.fbc-export-theme) .fbc-type-bal-amt { font-size: 16px; }
}
@media (max-width: 380px) {
  .card.fbc:not(.fbc-export-theme) .fbc-type { flex-wrap: wrap; row-gap: 10px; }
  .card.fbc:not(.fbc-export-theme) .fbc-type-sep { display: none; }
  .card.fbc:not(.fbc-export-theme) .fbc-type-bal { flex: 1 1 100%; display: flex; justify-content: space-between; align-items: baseline; padding-top: 10px; border-top: .5px solid var(--fbc-line); }
}
.dash-fb .card.fbc:not(.fbc-export-theme) .fbc-type { flex-wrap: wrap; row-gap: 10px; gap: 10px; padding: 14px; }
.dash-fb .card.fbc:not(.fbc-export-theme) .fbc-type-sep { display: none; }
.dash-fb .card.fbc:not(.fbc-export-theme) .fbc-type-bal { flex: 1 1 100%; display: flex; justify-content: space-between; align-items: baseline; padding-top: 10px; border-top: .5px solid var(--fbc-line); }
@media (max-width: 359.98px) {
  .card.fbc { padding: 16px 12px 12px; }
  .fbc-name { font-size: 19px; line-height: 23px; }
  .fbc-grand-amt { font-size: 27px; line-height: 34px; }
}

/* ---- Export theme: always 420 px wide, square full-bleed canvas (no white edges), light palette ---- */
.card.fbc.fbc-export-theme { box-shadow: none; width: 420px; max-width: none; margin: 0; border-radius: 0; }
html.is-exporting .card.fbc.fbc-export-theme { box-shadow: none !important; } /* no hairline ring around the exported image */
.card.fbc.fbc-export-theme .fbc-foot-row { flex-wrap: nowrap; } /* logo + brand stay on the right */
.fbc-body { overflow-x: auto; }
.fbc-head { flex-wrap: wrap; }
.fbc-table td { overflow-wrap: anywhere; }
.fbc-table .fbc-c-amt { white-space: nowrap; }
.fbw-total-row { flex-wrap: wrap; }
.fbw-empty { padding: 1rem; text-align: center; color: #6b6b70; }
.fbw-record-note { font-size: 12px; }
@media print {
  .card.fbc, .fbc-panel, .fbc-foot, .fbc-head, .fbc-grand, .fbc-tile, .fbc-total-row { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .card.fbc { background-image: var(--fbc-canvas) !important; border: 0 !important; }
}
