/* ============================================================
   Aventurine — the Aventurine Manage page's feature demos
   Load after css/budget-features.css. Wired by js/feature-demos.js.

   One small working replica of the app per feature row:
     .fd-ledger     Transactions: the search filters the rows, rows hover,
                    checkboxes tick
     .fd-dash       a dashboard built from the Widgets drawer, on a loop
     .fd-bud        Budgets: the circles, and the List they swap with
     .fd-stmt       Statements: the cash flow grid, Net pinned at the end
     .fd-pf         Portfolio: the allocation donut, by holding or by account
     .fd-rec        Recurring: a schedule's chips and its list row mark
                    each other
   Reports is another, drawn by js/feature-sankey.js (section 5).

   The app was redrawn in Ant Design, so these are too. Each replica uses the
   app's own values (static/css/ant.css and the page stylesheets), mirrored
   through the --app-* tokens in css/base.css plus the --fd-* set below, which
   is the app's light theme. A value here that looks arbitrary is usually
   Ant's: 32 is a control's height, 24 its small one, 14 the body size, 6 and
   8 the radii, 47 and 53 the ledger's header and row.

   SCALE. Every length is a multiple of --u, one design pixel. The panel
   (.fx-panel) is a size container, and --u divides its width by the width
   the replica was drawn at, so a replica scales as one picture with the
   panel: at the desktop panel width one unit is about one CSS pixel, the
   app's own size. The ledger and the calendar floor --u, so on a phone
   their type stays readable: the ledger's description column gives up the
   width, and the calendar runs off the window's left edge.

   Sections: 0 shared parts, 1 ledger, 2 dashboard, 3 budgets, 4 Cash Flow
   card, 5 Cash Flow diagram, 6 statements, 7 portfolio, 8 calendar.
   ============================================================ */


/* ============================================================
   0. Shared parts: tokens, icons, and the Ant components the replicas draw
   ============================================================ */
.fd {
  position: absolute;
  inset: 0;
  overflow: hidden;
  font-family: var(--fd-font);
  font-size: calc(14 * var(--u));
  line-height: 1.5714;
  color: var(--fd-text);
  background: var(--app-bg);
  -webkit-font-smoothing: antialiased;

  /* Ant's face is the system's own, as it is in the app */
  --fd-font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif;

  /* the app's light theme, token for token (ant.css section 1) */
  --fd-text: var(--app-text);
  --fd-text-2: var(--app-text-2);
  --fd-text-3: var(--app-text-3);
  --fd-border: var(--app-line);
  --fd-split: color-mix(in srgb, var(--app-line) 50%, var(--app-surface));
  --fd-fill-2: color-mix(in srgb, var(--app-text) 6%, transparent);
  --fd-fill-3: color-mix(in srgb, var(--app-text) 4%, transparent);
  --fd-fill-4: color-mix(in srgb, var(--app-text) 2%, transparent);
  --fd-head: color-mix(in srgb, var(--app-text) 3%, var(--app-surface));
  --fd-placeholder: color-mix(in srgb, var(--app-text) 35%, transparent);
  --fd-primary: var(--app-accent);
  --fd-primary-hover: #5b9f92;          /* --accent-primary-hover */
  --fd-primary-bg: color-mix(in srgb, var(--app-accent) 12%, var(--app-surface));
  --fd-primary-bg-hover: color-mix(in srgb, var(--app-accent) 20%, var(--app-surface));
  --fd-on-primary: var(--app-button-text);
  --fd-success: var(--app-green);       /* --accent-positive */
  --fd-error: var(--app-red);           /* --accent-negative */
  --fd-info: #1d4ed8;                   /* --accent-info: transfers */
  --fd-info-light: #4177ff;             /* --accent-info-light: money put away */

  /* AntV's categorical palette (--ant-chart-*) and the three direction stones */
  --fd-c1: #1783ff; --fd-c2: #00c9c9; --fd-c3: #7863ff; --fd-c4: #f0884d; --fd-c5: #60c42d;
  --fd-c6: #d580ff; --fd-c7: #2491b3; --fd-c8: #bd8f24; --fd-c9: #ff80ca; --fd-c10: #17c76f;
  --fd-emerald: #099e71;
  --fd-garnet: #b00d14;
  --fd-lapis: #1a49ae;
}

/* An Ant icon from the page's sprite (aventurine-manage.html, the first thing in <body>) */
.fd-ic {
  display: inline-block;
  flex: none;
  width: 1em;
  height: 1em;
  fill: currentColor;
  vertical-align: -.125em;
}

/* ---------- merchant avatar (ui.css .avatar-circle) ----------
   Initials on one of ten tints, each a light step of an Ant hue under a deep
   step of the same hue. The slot is the app's own: a djb2 hash of the
   merchant's name, modulo 10 (core/avatar.js), worked out once per name and
   written into the markup. */
.fd-av {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: calc(28 * var(--u));
  height: calc(28 * var(--u));
  border-radius: 50%;
  font-size: calc(11 * var(--u));
  line-height: 1;
  user-select: none;
}
.fd-av-0 { background: #bae0ff; color: #003eb3 }
.fd-av-1 { background: #b5f5ec; color: #006d75 }
.fd-av-2 { background: #d9f7be; color: #237804 }
.fd-av-3 { background: #fff1b8; color: #ad6800 }
.fd-av-4 { background: #ffd8bf; color: #ad2102 }
.fd-av-5 { background: #ffd6e7; color: #9e1068 }
.fd-av-6 { background: #efdbff; color: #391085 }
.fd-av-7 { background: #d6e4ff; color: #10239e }
.fd-av-8 { background: #f4ffb8; color: #5b8c00 }
.fd-av-9 { background: #ffe7ba; color: #ad4e00 }

/* Brand icons (ui.css .avatar-circle-icon / -bleed). A mark on transparency
   sits inset on a pale disc; a full-bleed colour tile fills the circle. Which
   is which comes from MERCHANT_ICONS_BLEED in the app's merchant-icons.js.
   The files are copies of the app's static/merchant-icons/. */
.fd-av-icon { background: #f0f0f2; overflow: hidden }   /* --avatar-icon-bg */
.fd-av-icon img { width: 78%; height: 78%; object-fit: contain; pointer-events: none }
.fd-av-bleed img { width: 100%; height: 100%; object-fit: cover }

/* ---------- Button ---------- */
.fd-btn {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  gap: calc(8 * var(--u));
  height: calc(32 * var(--u));
  padding: 0 calc(15 * var(--u));
  border: 1px solid var(--fd-border);
  border-radius: calc(6 * var(--u));
  background: var(--app-surface);
  box-shadow: 0 calc(2 * var(--u)) 0 rgb(0 0 0 / .02);
  font-weight: 400;
  white-space: nowrap;
  color: var(--fd-text);
}
.fd-btn-primary {
  border-color: var(--fd-primary);
  background: var(--fd-primary);
  box-shadow: 0 calc(2 * var(--u)) 0 color-mix(in srgb, var(--app-accent) 10%, transparent);
  color: var(--fd-on-primary);
}
.fd-btn-sm { height: calc(24 * var(--u)); padding: 0 calc(7 * var(--u)); border-radius: calc(4 * var(--u)) }
.fd-btn-icon { width: calc(32 * var(--u)); padding: 0 }

/* ---------- Select, and the Input that sits beside it ---------- */
.fd-select,
.fd-input {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: calc(8 * var(--u));
  height: calc(32 * var(--u));
  padding: 0 calc(11 * var(--u));
  border: 1px solid var(--fd-border);
  border-radius: calc(6 * var(--u));
  background: var(--app-surface);
  white-space: nowrap;
}
.fd-select .fd-ph { flex: 1; color: var(--fd-placeholder) }
.fd-select .fd-ic { font-size: calc(12 * var(--u)); color: var(--fd-text-3) }
.fd-input { flex: 1; min-width: 0 }
.fd-input .fd-ic { color: var(--fd-text-2) }
.fd-input-el {
  flex: 1;
  min-width: 0;
  width: 100%;
  padding: 0;
  border: 0;
  outline: 0;
  background: none;
  font: inherit;
  color: var(--fd-text);
}
.fd-input-el::placeholder { color: var(--fd-placeholder); opacity: 1 }
.fd-input:focus-within { border-color: var(--fd-primary); box-shadow: 0 0 0 calc(2 * var(--u)) color-mix(in srgb, var(--app-accent) 20%, transparent) }

/* ---------- Tag ---------- */
.fd-tag {
  display: inline-block;
  height: calc(22 * var(--u));
  padding: 0 calc(7 * var(--u));
  border: 1px solid transparent;
  border-radius: calc(4 * var(--u));
  font-size: calc(12 * var(--u));
  line-height: calc(20 * var(--u));
  white-space: nowrap;
}
.fd-tag-hue {
  border-color: color-mix(in srgb, var(--h) 33%, transparent);
  background: color-mix(in srgb, var(--h) 11%, transparent);
  color: color-mix(in srgb, var(--h) 62%, #000);
}

/* ---------- Checkbox (ant.css .ant-checkbox) ---------- */
.fd-check {
  position: relative;
  flex: none;
  width: calc(16 * var(--u));
  height: calc(16 * var(--u));
  margin: 0;
  border: 1px solid var(--fd-border);
  border-radius: calc(4 * var(--u));
  background: var(--app-surface);
  appearance: none;
  cursor: pointer;
  transition: background-color .2s, border-color .2s;
}
.fd-check::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 25%;
  width: calc(5.7 * var(--u));
  height: calc(9.1 * var(--u));
  border: calc(2 * var(--u)) solid var(--fd-on-primary);
  border-top: 0;
  border-left: 0;
  opacity: 0;
  transform: rotate(45deg) scale(0) translate(-50%, -50%);
  transition: transform .1s cubic-bezier(.645, .045, .355, 1), opacity .1s;
}
.fd-check:checked { border-color: var(--fd-primary); background: var(--fd-primary) }
.fd-check:checked::after {
  opacity: 1;
  transform: rotate(45deg) scale(1) translate(-50%, -50%);
  transition: transform .2s cubic-bezier(.12, .4, .29, 1.46) .1s;
}
.fd-check:indeterminate { background: var(--app-surface) }
.fd-check:indeterminate::after {
  left: 50%;
  width: calc(8 * var(--u));
  height: calc(8 * var(--u));
  border: 0;
  background: var(--fd-primary);
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}
.fd-check:not(:checked):hover { border-color: var(--fd-primary) }
.fd-check:focus-visible { outline: 2px solid var(--fd-primary); outline-offset: 2px }

/* ---------- Card, and its Statistic ---------- */
.fd-card {
  border: 1px solid var(--fd-split);
  border-radius: calc(8 * var(--u));
  background: var(--app-surface);
}
.fd-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: calc(8 * var(--u));
  min-height: calc(46 * var(--u));
  padding: 0 calc(12 * var(--u));
  border-bottom: 1px solid var(--fd-split);
  font-weight: 600;
}
.fd-card-title { display: flex; align-items: center; min-width: 0; white-space: nowrap }
.fd-info { margin-left: calc(6 * var(--u)); font-size: calc(14 * var(--u)); font-weight: 400; color: var(--fd-text-3) }
.fd-stat { padding: calc(12 * var(--u)) }
.fd-stat-title { margin-bottom: calc(4 * var(--u)); color: var(--fd-text-3); white-space: nowrap }
.fd-stat-value {
  font-size: calc(24 * var(--u));
  line-height: calc(32 * var(--u));
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.fd-stat-suffix { margin-left: calc(6 * var(--u)); font-size: calc(13 * var(--u)); color: var(--fd-text-3) }
.fd-stat-value.is-in   { color: var(--fd-success) }
.fd-stat-value.is-out  { color: var(--fd-error) }
.fd-stat-value.is-move { color: var(--fd-info) }

/* ---------- Segmented ---------- */
.fd-seg {
  display: inline-flex;
  flex: none;
  gap: calc(2 * var(--u));
  padding: calc(2 * var(--u));
  border-radius: calc(6 * var(--u));
  background: var(--fd-fill-2);
}
.fd-seg-item {
  display: inline-flex;
  align-items: center;
  gap: calc(6 * var(--u));
  height: calc(28 * var(--u));
  padding: 0 calc(11 * var(--u));
  border: 0;
  border-radius: calc(4 * var(--u));
  background: none;
  font: inherit;
  color: var(--fd-text-2);
  cursor: pointer;
  transition: background-color .2s, color .2s;
}
.fd-seg-item:hover { color: var(--fd-text) }
.fd-seg-item[aria-pressed="true"] {
  background: var(--app-surface);
  box-shadow: 0 1px 2px rgb(0 0 0 / .08), 0 1px 6px -1px rgb(0 0 0 / .06);
  color: var(--fd-text);
}
.fd-seg-item:focus-visible { outline: 2px solid var(--fd-primary); outline-offset: 1px }
.fd-seg-sm .fd-seg-item { height: calc(22 * var(--u)); padding: 0 calc(8 * var(--u)) }

/* ---------- line Tabs ---------- */
.fd-tabs {
  display: flex;
  align-items: stretch;
  gap: calc(32 * var(--u));
  height: calc(46 * var(--u));
  border-bottom: 1px solid var(--fd-split);
}
.fd-tab { position: relative; display: flex; align-items: center; color: var(--fd-text) }
.fd-tab.is-on { color: var(--fd-primary) }
.fd-tab.is-on::after {
  content: '';
  position: absolute;
  inset: auto 0 -1px;
  height: calc(2 * var(--u));
  background: var(--fd-primary);
}

/* a number that must not move under a changing figure */
.fd-num { font-variant-numeric: tabular-nums }


/* ============================================================
   1. The ledger (transactions.css)
   One card: the filters, then the table. The search is live: it filters
   the rows (js/feature-demos.js). Selection is the checkbox alone: a ticked
   row takes the primary wash through :has(), so the rows need no script.
   The script only keeps the header's select-all box in step with them.
   ============================================================ */
.fd-ledger { --u: max(.7px, calc(100cqw / 520)); background: var(--app-surface) }

.fd-tx-filters {
  display: flex;
  align-items: center;
  gap: calc(8 * var(--u));
  padding: calc(14 * var(--u)) calc(16 * var(--u));
}

.fd-tx { width: 100%; table-layout: fixed; border-collapse: separate; border-spacing: 0 }
.fd-tx th,
.fd-tx td {
  padding: calc(12 * var(--u)) calc(8 * var(--u));
  border-bottom: 1px solid var(--fd-split);
  text-align: left;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  transition: background-color .2s;
}
.fd-tx thead th {
  height: calc(47 * var(--u));
  background: var(--fd-head);
  font-weight: 600;
}
.fd-tx thead th { position: relative }
/* Ant's column divider: a short rule at the cell's end */
.fd-tx thead th:not(:last-child):not(.fd-tx-select)::before {
  content: '';
  position: absolute;
  top: 50%;
  right: 0;
  width: 1px;
  height: 1.6em;
  background: var(--fd-split);
  transform: translateY(-50%);
}
.fd-tx .fd-tx-select { width: calc(36 * var(--u)); padding: 0; text-align: center }
.fd-tx .fd-tx-date { width: calc(108 * var(--u)) }
.fd-tx .fd-tx-cat { width: calc(128 * var(--u)) }
.fd-tx .fd-tx-amount { width: calc(106 * var(--u)); text-align: right; font-variant-numeric: tabular-nums }
.fd-tx td { height: calc(53 * var(--u)) }
.fd-tx td.fd-tx-date { font-variant-numeric: tabular-nums }
.fd-tx-desc { display: flex; align-items: center; gap: calc(8 * var(--u)); min-width: 0 }
.fd-tx-desc span:last-child { overflow: hidden; text-overflow: ellipsis }

/* the date column is the one the ledger is sorted by: its header takes the tint, its cells do not */
.fd-tx thead .fd-tx-sorted { background: var(--fd-fill-2) }
.fd-tx-sorter { display: inline-flex; flex-direction: column; margin-left: calc(6 * var(--u)); vertical-align: middle; line-height: 0 }
.fd-tx-sorter .fd-ic { font-size: calc(11 * var(--u)); color: var(--fd-text-3) }
.fd-tx-sorter .fd-ic + .fd-ic { margin-top: calc(-3.3 * var(--u)) }
.fd-tx-sorter .is-on { color: var(--fd-primary) }

/* the whole cell is the checkbox's hit area, not just the 16px box */
.fd-tx-hit { display: flex; align-items: center; justify-content: center; height: calc(53 * var(--u)); cursor: pointer }
.fd-tx thead .fd-tx-hit { height: calc(47 * var(--u)) }

.fd-tx tbody tr:hover td { background: var(--fd-fill-3) }
.fd-tx tbody tr:has(.fd-check:checked) td { background: var(--fd-primary-bg) }
.fd-tx tbody tr:has(.fd-check:checked):hover td { background: var(--fd-primary-bg-hover) }
.fd-tx tbody tr[hidden] { display: none }

/* a ledger the search has emptied */
.fd-tx-none { display: none; padding: calc(40 * var(--u)) 0; text-align: center; color: var(--fd-text-3) }
.fd-tx-none.is-shown { display: block }

/* direction: an expense is plain text, money arriving is green */
.fd-amt-income { color: var(--fd-success) }


/* A small icon inside a small button */
.fd-btn-sm .fd-ic-s { font-size: calc(12 * var(--u)); color: var(--fd-text-3) }


/* ============================================================
   2. The dashboard (dashboard.css, ant.css Drawer)
   One loop, --fd-t long, told entirely by keyframes that share it. The
   layout is being customised and its grid is empty. The pointer presses Add
   widgets, the Widgets drawer slides in over a mask, and Add puts Net Worth,
   Income & Expenses and Spending on the grid, one card landing for each;
   the pointer closes the drawer and presses Save, the toolbar goes back to
   Customize, and the finished dashboard holds, fades, and the loop starts
   again. The charts themselves never animate: each card lands with its
   chart already drawn.

   The rules outside the motion query are the FINISHED dashboard, so with
   reduced motion that is what shows, still. Every animation lives inside
   the query and fills both ways, so while it runs it owns the state.
   js/feature-demos.js pauses the loop while the demo is off screen.

   Stage: 520 x 390 units, which is the 4:3 panel. Geometry the keyframes
   point at (the pointer's stops are the tips):
     main           14 in from every edge; toolbar 46 high, 12 gap
     canvas         top 72, two rows of 146
     slots          A top, full width; B bottom left; C bottom right
     Add widgets    centred at 286, 34       Save centred at 473, 34
     drawer         x 248-520; its close icon centred at 272, 26
     Add buttons    centred at x 463, y 145, 217 and 288
     These were read off the rendered page rather than worked out, since
     the toolbar's buttons sit on its baseline, not its middle. If the
     drawer's type or spacing changes, measure them again.
   ============================================================ */
.fd-dash {
  --u: calc(100cqw / 520);
  --fd-t: 14s;
  contain: layout paint;
}

.fd-dash-main {
  position: absolute;
  inset: calc(14 * var(--u));
  display: flex;
  flex-direction: column;
  gap: calc(12 * var(--u));
}

/* the toolbar: the layouts' tabs, and what acts on them at the end */
.fd-dash-bar { position: relative; flex: none; height: calc(46 * var(--u)) }
.fd-dash-barview,
.fd-dash-baredit { position: absolute; inset: 0 }
.fd-dash-baredit { display: flex; align-items: flex-end; gap: calc(4 * var(--u)); border-bottom: 1px solid var(--fd-split); opacity: 0 }
.fd-tabs-extra { display: flex; gap: calc(8 * var(--u)); margin-left: auto; align-self: center }
.fd-dash-baredit .fd-tabs-extra { margin-bottom: calc(7 * var(--u)) }

/* Ant's editable card tabs, the form the layouts take while they can be closed */
.fd-tabcard {
  display: inline-flex;
  align-items: center;
  gap: calc(10 * var(--u));
  height: calc(36 * var(--u));
  padding: 0 calc(12 * var(--u));
  border: 1px solid var(--fd-split);
  border-bottom: 0;
  border-radius: calc(8 * var(--u)) calc(8 * var(--u)) 0 0;
  background: var(--fd-head);
}
.fd-tabcard.is-on { margin-bottom: -1px; height: calc(37 * var(--u)); background: var(--app-surface); color: var(--fd-primary) }
.fd-tabcard .fd-ic { font-size: calc(12 * var(--u)); color: var(--fd-text-3) }
.fd-tabcard-add { width: calc(36 * var(--u)); padding: 0; justify-content: center }

.fd-dash-canvas { position: relative; flex: 1; min-height: 0 }
.fd-dash-slot-a,
.fd-dash-slot-b,
.fd-dash-slot-c { position: absolute; height: calc(50% - 6 * var(--u)) }
.fd-dash-slot-a { top: 0; left: 0; right: 0 }
.fd-dash-slot-b { bottom: 0; left: 0; width: calc(56% - 6 * var(--u)) }
.fd-dash-slot-c { bottom: 0; right: 0; width: calc(44% - 6 * var(--u)) }

/* where a widget will land: the grid's empty cells while customising */
.fd-dash-ph {
  border: calc(1.5 * var(--u)) dashed color-mix(in srgb, var(--app-accent) 55%, transparent);
  border-radius: calc(8 * var(--u));
  background: color-mix(in srgb, var(--app-accent) 7%, transparent);
  opacity: 0;
}

/* a card: Ant's small Card, head over body */
.fd-dash-card {
  display: flex;
  flex-direction: column;
  overflow: visible;
  outline: calc(1.5 * var(--u)) dashed transparent;
  outline-offset: calc(2 * var(--u));
}
.fd-dash-card .fd-card-head { position: relative; flex: none; min-height: calc(46 * var(--u)) }
.fd-dash-card .fd-card-title { font-size: calc(14 * var(--u)); gap: 0 }
.fd-dash-grip,
.fd-dash-x { position: absolute; top: 50%; translate: 0 -50%; opacity: 0; color: var(--fd-text-3) }
.fd-dash-grip { left: calc(-1 * var(--u)); font-size: calc(14 * var(--u)) }
.fd-dash-x { right: calc(10 * var(--u)); font-size: calc(14 * var(--u)); color: var(--fd-error) }
.fd-dash-body {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: calc(8 * var(--u));
  min-height: 0;
  padding: calc(10 * var(--u)) calc(14 * var(--u)) calc(12 * var(--u));
}
.fd-dash-body-nw { flex-direction: row; align-items: center; gap: calc(18 * var(--u)) }
.fd-dash-figure { flex: none }
.fd-dash-value { font-size: calc(24 * var(--u)); font-weight: 600; line-height: calc(32 * var(--u)); font-variant-numeric: tabular-nums; white-space: nowrap }
.fd-dash-delta { font-size: calc(12 * var(--u)); color: var(--fd-success); white-space: nowrap }
.fd-dash-chips { display: flex; flex: none; gap: calc(6 * var(--u)) }
.fd-dash-chip {
  display: inline-flex;
  align-items: center;
  gap: calc(6 * var(--u));
  height: calc(22 * var(--u));
  padding: 0 calc(9 * var(--u));
  border-radius: 999px;
  font-size: calc(12 * var(--u));
  color: #fff;
}
.fd-dash-chip::before { content: ''; width: calc(7 * var(--u)); height: calc(7 * var(--u)); border-radius: 50%; background: #fff }
.fd-dash-chip-in  { background: var(--fd-success) }
.fd-dash-chip-out { background: var(--fd-error) }

/* The plots stretch with their card (preserveAspectRatio="none"); non-scaling
   strokes keep the lines' weight while they do. */
.fd-dash-plot { position: relative; flex: 1; align-self: stretch; min-height: 0; min-width: 0 }
.fd-dash-plot svg { position: absolute; inset: 0; width: 100%; height: 100% }
.fd-dash-plot path { vector-effect: non-scaling-stroke }

/* Add widgets, over a mask */
.fd-dash-mask { position: absolute; inset: 0; background: rgb(0 0 0 / .45); opacity: 0; pointer-events: none }
.fd-dash-drawer {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: calc(272 * var(--u));
  padding: 0 calc(16 * var(--u));
  background: var(--app-surface);
  box-shadow: calc(-6 * var(--u)) 0 calc(16 * var(--u)) rgb(0 0 0 / .08);
  opacity: 0;
  translate: 100% 0;
  pointer-events: none;
}
.fd-dash-dhead {
  display: flex;
  align-items: center;
  gap: calc(12 * var(--u));
  height: calc(52 * var(--u));
  margin: 0 calc(-16 * var(--u));
  padding: 0 calc(16 * var(--u));
  border-bottom: 1px solid var(--fd-split);
  font-size: calc(16 * var(--u));
  font-weight: 600;
}
.fd-dash-dhead .fd-ic { font-size: calc(16 * var(--u)); color: var(--fd-text-2) }
.fd-dash-hint { margin-top: calc(12 * var(--u)); font-size: calc(12 * var(--u)); line-height: 1.5; color: var(--fd-text-2) }
.fd-dash-section { margin: calc(10 * var(--u)) 0 calc(8 * var(--u)); font-size: calc(11 * var(--u)); letter-spacing: .08em; text-transform: uppercase; color: var(--fd-text-3) }
.fd-dash-row {
  display: flex;
  align-items: center;
  gap: calc(8 * var(--u));
  margin-bottom: calc(8 * var(--u));
  padding: calc(8 * var(--u));
  border: 1px solid var(--fd-split);
  border-radius: calc(8 * var(--u));
}
.fd-dash-thumb {
  display: grid;
  flex: none;
  place-items: center;
  width: calc(46 * var(--u));
  height: calc(36 * var(--u));
  border-radius: calc(6 * var(--u));
  background: var(--fd-head);
  color: var(--fd-primary);
}
.fd-dash-thumb svg { width: calc(34 * var(--u)); height: calc(21 * var(--u)) }
.fd-dash-wtext { flex: 1; display: flex; flex-direction: column; min-width: 0; line-height: 1.4 }
.fd-dash-wname { font-weight: 600 }
.fd-dash-wmeta { display: flex; align-items: center; gap: calc(4 * var(--u)); font-size: calc(12 * var(--u)); color: var(--fd-text-2); opacity: 0 }

/* the pointer */
.fd-dash-cursor { position: absolute; top: 0; left: 0; opacity: 0; pointer-events: none }
.fd-dash-arrow { position: absolute; top: 0; left: 0; width: calc(15 * var(--u)); height: calc(22 * var(--u)); transform-origin: 0 0 }

@media (prefers-reduced-motion: no-preference) {
  .fd-dash-barview  { animation: fd-dash-view var(--fd-t) ease infinite both }
  .fd-dash-baredit  { animation: fd-dash-edit var(--fd-t) ease infinite both }
  .fd-dash-mask     { animation: fd-dash-mask var(--fd-t) ease-in-out infinite both }
  .fd-dash-drawer   { animation: fd-dash-drawer var(--fd-t) cubic-bezier(.23, 1, .32, 1) infinite both }
  .fd-dash-cursor   { animation: fd-dash-cursor var(--fd-t) ease-in-out infinite both }
  .fd-dash-arrow    { animation: fd-dash-press var(--fd-t) ease infinite both }
  .fd-dash-addw     { animation: fd-dash-addw var(--fd-t) linear infinite both }
  .fd-dash-save     { animation: fd-dash-save var(--fd-t) linear infinite both }

  .fd-dash-ph.fd-dash-slot-a { animation: fd-dash-ph-a var(--fd-t) linear infinite both }
  .fd-dash-ph.fd-dash-slot-b { animation: fd-dash-ph-b var(--fd-t) linear infinite both }
  .fd-dash-ph.fd-dash-slot-c { animation: fd-dash-ph-c var(--fd-t) linear infinite both }

  .fd-dash-card { animation-duration: var(--fd-t), var(--fd-t); animation-iteration-count: infinite; animation-fill-mode: both; animation-timing-function: cubic-bezier(.2, .8, .2, 1), ease }
  .fd-dash-card-nw { animation-name: fd-dash-card-a, fd-dash-edge }
  .fd-dash-card-ie { animation-name: fd-dash-card-b, fd-dash-edge }
  .fd-dash-card-sp { animation-name: fd-dash-card-c, fd-dash-edge }
  .fd-dash-grip, .fd-dash-x { animation: fd-dash-deco var(--fd-t) ease infinite both }
  .fd-dash-sel { animation: fd-dash-sel var(--fd-t) ease infinite both }

  .fd-dash-row-a .fd-dash-add { animation: fd-dash-add-a var(--fd-t) linear infinite both }
  .fd-dash-row-b .fd-dash-add { animation: fd-dash-add-b var(--fd-t) linear infinite both }
  .fd-dash-row-c .fd-dash-add { animation: fd-dash-add-c var(--fd-t) linear infinite both }
  .fd-dash-row-a .fd-dash-wmeta { animation: fd-dash-meta-a var(--fd-t) linear infinite both }
  .fd-dash-row-b .fd-dash-wmeta { animation: fd-dash-meta-b var(--fd-t) linear infinite both }
  .fd-dash-row-c .fd-dash-wmeta { animation: fd-dash-meta-c var(--fd-t) linear infinite both }

  /* off screen: held where it is (js/feature-demos.js) */
  .fd-dash.is-paused,
  .fd-dash.is-paused * { animation-play-state: paused }
}

/* customising until 75%, saved by 78%, held to 95%, reset by 99% */
@keyframes fd-dash-view { 0%, 75% { opacity: 0 } 78%, 95% { opacity: 1 } 99%, 100% { opacity: 0 } }
@keyframes fd-dash-edit { 0%, 75% { opacity: 1 } 78%, 95% { opacity: 0 } 99%, 100% { opacity: 1 } }
@keyframes fd-dash-deco { 0%, 75% { opacity: 1 } 78%, 95% { opacity: 0 } 99%, 100% { opacity: 1 } }
@keyframes fd-dash-sel  { 0%, 75% { margin-right: calc(26 * var(--u)) } 78%, 95% { margin-right: 0 } 99%, 100% { margin-right: calc(26 * var(--u)) } }

/* the mask and the drawer: open from 11% to 62% */
@keyframes fd-dash-mask {
  0%, 10%   { opacity: 0 }
  14%, 62%  { opacity: 1 }
  66%, 100% { opacity: 0 }
}
@keyframes fd-dash-drawer {
  0%, 10%   { opacity: 0; translate: 100% 0 }
  15%, 62%  { opacity: 1; translate: 0 0 }
  67%, 100% { opacity: 0; translate: 100% 0 }
}

/* the pointer: rest, Add widgets, three Adds, the drawer's close, Save */
@keyframes fd-dash-cursor {
  0%        { translate: calc(250 * var(--u)) calc(320 * var(--u)); opacity: 0 }
  3%        { translate: calc(250 * var(--u)) calc(320 * var(--u)); opacity: 1 }
  8%, 11%   { translate: calc(286 * var(--u)) calc(34 * var(--u)) }
  19%, 22%  { translate: calc(463 * var(--u)) calc(145 * var(--u)) }
  32%, 35%  { translate: calc(463 * var(--u)) calc(217 * var(--u)) }
  45%, 48%  { translate: calc(463 * var(--u)) calc(288 * var(--u)) }
  58%, 62%  { translate: calc(272 * var(--u)) calc(26 * var(--u)) }
  71%, 75%  { translate: calc(473 * var(--u)) calc(34 * var(--u)); opacity: 1 }
  79%       { translate: calc(455 * var(--u)) calc(110 * var(--u)); opacity: 0 }
  100%      { translate: calc(250 * var(--u)) calc(320 * var(--u)); opacity: 0 }
}
/* a short squeeze on each press */
@keyframes fd-dash-press {
  0%, 10%, 11.8%, 21%, 22.8%, 34%, 35.8%, 47%, 48.8%, 61%, 62.8%, 73.2%, 75%, 100% { scale: 1 }
  10.4%, 11.2%, 21.4%, 22.2%, 34.4%, 35.2%, 47.4%, 48.2%, 61.4%, 62.2%, 73.6%, 74.4% { scale: .85 }
}
@keyframes fd-dash-addw {
  0%, 10%     { background: var(--app-surface) }
  10.4%, 11.4% { background: var(--fd-fill-2) }
  11.8%, 100% { background: var(--app-surface) }
}
@keyframes fd-dash-save {
  0%, 73%     { background: var(--fd-primary) }
  73.4%, 74.6% { background: #365e56 }   /* pressed: accent-800 */
  75%, 100%   { background: var(--fd-primary) }
}
@keyframes fd-dash-add-a { 0%, 21% { background: var(--app-surface) } 21.4%, 22.4% { background: var(--fd-fill-2) } 22.8%, 100% { background: var(--app-surface) } }
@keyframes fd-dash-add-b { 0%, 34% { background: var(--app-surface) } 34.4%, 35.4% { background: var(--fd-fill-2) } 35.8%, 100% { background: var(--app-surface) } }
@keyframes fd-dash-add-c { 0%, 47% { background: var(--app-surface) } 47.4%, 48.4% { background: var(--fd-fill-2) } 48.8%, 100% { background: var(--app-surface) } }

/* the empty cells, until their widget is added */
@keyframes fd-dash-ph-a { 0%, 22.5% { opacity: 1 } 23.5%, 99% { opacity: 0 } 100% { opacity: 1 } }
@keyframes fd-dash-ph-b { 0%, 35.5% { opacity: 1 } 36.5%, 99% { opacity: 0 } 100% { opacity: 1 } }
@keyframes fd-dash-ph-c { 0%, 48.5% { opacity: 1 } 49.5%, 99% { opacity: 0 } 100% { opacity: 1 } }

/* a card lands (dashboard.css dash-card-in), holds, and fades for the reset */
@keyframes fd-dash-card-a {
  0%, 22.5%    { opacity: 0; translate: 0 calc(8 * var(--u)) }
  25.5%, 91%   { opacity: 1; translate: 0 0 }
  94%, 100%    { opacity: 0; translate: 0 0 }
}
@keyframes fd-dash-card-b {
  0%, 35.5%    { opacity: 0; translate: 0 calc(8 * var(--u)) }
  38.5%, 91%   { opacity: 1; translate: 0 0 }
  94%, 100%    { opacity: 0; translate: 0 0 }
}
@keyframes fd-dash-card-c {
  0%, 48.5%    { opacity: 0; translate: 0 calc(8 * var(--u)) }
  51.5%, 91%   { opacity: 1; translate: 0 0 }
  94%, 100%    { opacity: 0; translate: 0 0 }
}
/* while customising a card wears the dashed edge of its cell */
@keyframes fd-dash-edge {
  0%, 75%   { outline-color: color-mix(in srgb, var(--app-accent) 60%, transparent) }
  78%, 100% { outline-color: transparent }
}

/* "On this layout", once the widget is placed */
@keyframes fd-dash-meta-a { 0%, 22.8% { opacity: 0 } 24%, 95% { opacity: 1 } 96%, 100% { opacity: 0 } }
@keyframes fd-dash-meta-b { 0%, 35.8% { opacity: 0 } 37%, 95% { opacity: 1 } 96%, 100% { opacity: 0 } }
@keyframes fd-dash-meta-c { 0%, 48.8% { opacity: 0 } 50%, 95% { opacity: 1 } 96%, 100% { opacity: 0 } }

/* ============================================================
   3. Budgets (budgets.css)
   The Budgets page: the month and the view, three of its four totals, and
   one card. In Circles each category is a circle sized by its target,
   filled to what is spent, with a waterline along the level; red is over
   its target and blue is money put away. List swaps the card's body for the
   same figures as a table (js/feature-demos.js). The circles are placed by
   hand: the app settles them with a small physics simulation.

   Drawn 560 wide, the panel's widest, so one unit is one of the app's pixels
   at desktop width.
   ============================================================ */
.fd-bud { --u: calc(100cqw / 560) }
.fd-bud-stage {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  gap: calc(12 * var(--u));
  padding: calc(12 * var(--u));
}
.fd-bud-bar { display: flex; flex: none; align-items: center; gap: calc(8 * var(--u)) }
.fd-bud-set { margin-left: auto }
.fd-picker {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: calc(8 * var(--u));
  width: calc(136 * var(--u));
  height: calc(32 * var(--u));
  padding: 0 calc(11 * var(--u));
  border: 1px solid var(--fd-border);
  background: var(--app-surface);
  white-space: nowrap;
}
.fd-picker .fd-ic { color: var(--fd-text-3) }
.fd-btn.is-disabled { border-color: var(--fd-border); background: var(--fd-fill-3); box-shadow: none; color: color-mix(in srgb, var(--app-text) 30%, transparent) }
.fd-bud-stats { display: grid; flex: none; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: calc(12 * var(--u)) }
.fd-bud-card { display: flex; flex: 1; flex-direction: column; min-height: 0; overflow: hidden }

/* The circles sit in this box, which is their containing block. Clipped, so
   a circle can never raise a scrollbar, with room to paint a hovered
   circle's growth. The type is sized off each circle's diameter, as the app
   sizes it off the circle's box with container units; those cannot be used
   here, because --u is itself written in container units and a circle that
   was a container would resolve it against its own width. */
.fd-bud-field { position: relative; flex: 1; margin: calc(8 * var(--u)); overflow: clip; overflow-clip-margin: calc(8 * var(--u)) }
.fd-bub {
  --paint: var(--fd-primary);
  --tint: color-mix(in srgb, var(--paint) 20%, transparent);
  position: absolute;
  left: calc(var(--x) * var(--u));
  top: calc(var(--y) * var(--u));
  width: calc(var(--d) * var(--u));
  height: calc(var(--d) * var(--u));
  display: grid;
  place-items: center;
  box-sizing: border-box;
  padding: 0;
  border: calc(1.5 * var(--u)) solid var(--paint);
  border-radius: 50%;
  background: var(--app-surface);
  font: inherit;
  color: var(--fd-text);
  cursor: pointer;
  overflow: hidden;
  transition: scale .15s ease;
}
.fd-bub:hover { z-index: 1; scale: 1.02 }
.fd-bub:active { scale: 1 }
.fd-bub:focus-visible { z-index: 1; outline: 2px solid var(--fd-primary); outline-offset: 2px }
.fd-bub-away { --paint: var(--fd-info-light) }
.fd-bub-over { --paint: var(--fd-error) }

/* the level: a tint, because the readout sits over it, with a waterline */
.fd-bub-fill {
  position: absolute;
  inset: auto 0 0;
  height: var(--fill, 0%);
  background: var(--tint);
  border-top: calc(1.5 * var(--u)) solid var(--paint);
  pointer-events: none;
}
.fd-bub-filled .fd-bub-fill { border-top-color: transparent }
.fd-bub-over .fd-bub-fill { height: 100%; background: color-mix(in srgb, var(--fd-error) 8%, var(--app-surface)); border-top-color: transparent }

.fd-bub-text {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  max-width: 80%;
  line-height: 1.2;
  text-align: center;
}
.fd-bub-name,
.fd-bub-target {
  max-width: 100%;
  overflow: hidden;
  font-size: clamp(calc(11 * var(--u)), calc(var(--d) * .065 * var(--u)), calc(15 * var(--u)));
  text-overflow: ellipsis;
  white-space: nowrap;
}
.fd-bub-name { color: var(--fd-text-2) }
.fd-bub-target { color: var(--fd-text-3); font-variant-numeric: tabular-nums }
.fd-bub-spent {
  max-width: 100%;
  overflow: hidden;
  font-size: clamp(calc(12 * var(--u)), calc(var(--d) * .135 * var(--u)), calc(30 * var(--u)));
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.01em;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.fd-bub-over .fd-bub-spent { color: var(--fd-error) }

/* List */
.fd-bud-table { width: 100%; border-collapse: separate; border-spacing: 0 }
.fd-bud-table[hidden] { display: none }
.fd-bud-table th,
.fd-bud-table td { padding: calc(14 * var(--u)) calc(16 * var(--u)); border-bottom: 1px solid var(--fd-split); text-align: left; white-space: nowrap }
.fd-bud-table thead th { background: var(--fd-head); font-weight: 600 }
.fd-bud-table .fd-end { text-align: right }
.fd-bud-table .is-out { color: var(--fd-error) }
.fd-bud-table td:first-child { width: calc(150 * var(--u)) }
.fd-bud-table td:nth-child(3),
.fd-bud-table td:nth-child(4) { width: calc(84 * var(--u)) }
.fd-bud-away { margin-left: calc(6 * var(--u)); color: var(--fd-text-3) }
.fd-prog { --bar: var(--fd-primary); display: flex; align-items: center; gap: calc(10 * var(--u)) }
.fd-prog i {
  flex: 1;
  height: calc(6 * var(--u));
  border-radius: calc(3 * var(--u));
  background: linear-gradient(to right, var(--bar) var(--p), var(--fd-fill-3) var(--p));
}
.fd-prog b { width: calc(34 * var(--u)); font-size: calc(12 * var(--u)); font-weight: 400; color: var(--fd-text-2) }
.fd-prog-over { --bar: var(--fd-error) }
.fd-prog-over b { color: var(--fd-error) }
.fd-prog-away { --bar: var(--fd-info-light) }


/* ============================================================
   4. The Cash Flow card (Reports, forecast.css)
   The Reports page's first tab: the line tabs over one card, the card's
   head carrying the year and span pickers, and the diagram under it.
   Static: the tabs are there to say what else is on the page.
   ============================================================ */
.fd-rep { --u: calc(100cqw / 520) }
.fd-rep-main {
  position: absolute;
  inset: calc(14 * var(--u));
  display: flex;
  flex-direction: column;
  gap: calc(12 * var(--u));
}
.fd-rep-card { flex: 1; display: flex; flex-direction: column; min-height: 0; overflow: hidden }
.fd-rep-card .fd-card-head { flex: none }

/* Ant's compact group: controls sharing one edge */
.fd-compact { display: inline-flex; flex: none }
.fd-compact > * { border-radius: 0 }
.fd-compact > :first-child { border-radius: calc(6 * var(--u)) 0 0 calc(6 * var(--u)) }
.fd-compact > :last-child { border-radius: 0 calc(6 * var(--u)) calc(6 * var(--u)) 0 }
.fd-compact > * + * { margin-left: -1px }
.fd-select .fd-val { flex: 1; color: var(--fd-text) }


/* ============================================================
   5. The Cash Flow diagram (forecast.css, .cashflow-sankey)
   Drawn by js/feature-sankey.js in the card's body, centred, laid out at
   the body's size so its type is the app's own 12 / 13 / 11px: those
   lengths are SVG units, not CSS ones, scaled with the panel.

   Colours are the app's default palette (ant.css, section 1b), each the
   resolved value of the token named beside it. Money arriving is Ant's blue,
   deepest first; the hub, where every flow is totalled, is Ant's green; money
   leaving is one hue per category, in the order the app's outflow ramp runs
   (blue and green are left out of it, because they already mean something).
   ============================================================ */
.fd-sankey {
  --sk-net:   #52c41a;   /* --chart-net: --ant-chart-green */
  --sk-in-1:  #0958d9;   /* --chart-inflow-1 .. 6: Ant's blue-7 down to blue-2 */
  --sk-in-2:  #1677ff;
  --sk-in-3:  #4096ff;
  --sk-in-4:  #69b1ff;
  --sk-in-5:  #91caff;
  --sk-in-6:  #bae0ff;
  --sk-out-1: #00c9c9;   /* --chart-outflow-1 .. 8: cyan, orange, violet, gold, lilac, pink, volcano, purple */
  --sk-out-2: #f0884d;
  --sk-out-3: #7863ff;
  --sk-out-4: #bd8f24;
  --sk-out-5: #d580ff;
  --sk-out-6: #ff80ca;
  --sk-out-7: #fa541c;
  --sk-out-8: #722ed1;

  position: relative;
  flex: 1;
  min-height: 0;
}
.fd-sk { position: absolute; inset: 0; display: block; width: 100%; height: 100%; overflow: visible }

/* G2's Sankey links sit at about a third of their colour. A band brightens
   under the pointer. The channel between the hubs is a stage, not a
   category, so it sits outside .fd-sk-cat and never does. */
.fd-sk-link { opacity: .4; transition: opacity .15s ease }
.fd-sk-cat:hover .fd-sk-link { opacity: .7 }

/* Thin connector from a node to a label that was nudged off its band. */
.fd-sk-leader { stroke: var(--fd-text-3); stroke-width: 1; opacity: .45 }

.fd-sk-label { fill: var(--fd-text-2); font-size: 12px; font-weight: 400 }
.fd-sk-amount {
  fill: var(--fd-text);
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.fd-sk-share { fill: var(--fd-text-3); font-size: 11px; font-weight: 400 }

/* ============================================================
   6. Statements (statements.css)
   The cash flow statement: Ant's table with grouped headers, the Income and
   Expenses underlines in their own colours, and Month and Net pinned at the
   ends. The grid scrolls sideways, as it does in the app, and the pinned
   columns stay put. Computed values are drawn in the primary colour, a
   value typed over one in the text colour with the glyph that reverts it.
   Drawn 560 wide, one unit to the app's pixel at desktop width.
   ============================================================ */
.fd-stmt { --u: calc(100cqw / 560) }
.fd-stmt-stage {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  gap: calc(12 * var(--u));
  padding: calc(12 * var(--u));
}
.fd-stmt-year { width: calc(84 * var(--u)) }
.fd-stmt-card { display: flex; flex: 1; flex-direction: column; min-height: 0; overflow: hidden }
.fd-stmt-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--fd-border) transparent;
}
.fd-stmt-scroll:focus-visible { outline: 2px solid var(--fd-primary); outline-offset: -2px }
.fd-stmt-grid { width: max-content; min-width: 100%; border-collapse: separate; border-spacing: 0 }
.fd-stmt-grid th,
.fd-stmt-grid td {
  padding: calc(8 * var(--u)) calc(12 * var(--u));
  border-right: 1px solid var(--fd-split);
  border-bottom: 1px solid var(--fd-split);
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  transition: background-color .2s;
}
.fd-stmt-grid thead th { height: calc(40 * var(--u)); background: var(--fd-head); font-weight: 600 }
.fd-stmt-grid tbody td { height: calc(39 * var(--u)); background: var(--app-surface); color: var(--fd-primary) }
.fd-stmt-group { text-align: left !important }
.fd-stmt-col { border-bottom-width: calc(2 * var(--u)) !important }
.fd-stmt-in  { border-bottom-color: var(--fd-success) !important }
.fd-stmt-out { border-bottom-color: var(--fd-error) !important }

/* Month and Net, pinned to the grid's ends */
.fd-stmt-month,
.fd-stmt-net { position: sticky; z-index: 2 }
.fd-stmt-month { left: 0; min-width: calc(104 * var(--u)); text-align: left !important; font-weight: 600 }
.fd-stmt-net { right: 0; min-width: calc(104 * var(--u)); border-right: 0 !important; font-weight: 600 }
.fd-stmt-grid tbody th { background: var(--app-surface); color: var(--fd-text) }
.fd-stmt-grid thead .fd-stmt-month { box-shadow: calc(6 * var(--u)) 0 calc(8 * var(--u)) calc(-6 * var(--u)) rgb(0 0 0 / .2) }
.fd-stmt-grid tbody .fd-stmt-month { box-shadow: calc(6 * var(--u)) 0 calc(8 * var(--u)) calc(-6 * var(--u)) rgb(0 0 0 / .2) }
.fd-stmt-grid .fd-stmt-net { box-shadow: calc(-6 * var(--u)) 0 calc(8 * var(--u)) calc(-6 * var(--u)) rgb(0 0 0 / .2) }
.fd-stmt-grid tbody td.fd-stmt-net { color: var(--fd-success) }
.fd-stmt-net .fd-info { vertical-align: -.15em }
.fd-stmt-grid tbody td.fd-stmt-typed { color: var(--fd-text) }
.fd-stmt-typed .fd-ic { margin-right: calc(8 * var(--u)); font-size: calc(13 * var(--u)); color: var(--fd-text-3) }
.fd-stmt-grid tbody tr:hover > * { background: color-mix(in srgb, var(--app-text) 4%, var(--app-surface)) }

.fd-stmt-legend {
  display: flex;
  flex: none;
  gap: calc(16 * var(--u));
  padding: calc(9 * var(--u)) calc(12 * var(--u));
  border-top: 1px solid var(--fd-split);
  font-size: calc(12 * var(--u));
  line-height: calc(18 * var(--u));
  white-space: nowrap;
  overflow: hidden;
  color: var(--fd-text-2);
}
.fd-stmt-legend b { font-weight: 600; color: var(--fd-text) }
.fd-stmt-legend .fd-stmt-c { color: var(--fd-primary) }
.fd-stmt-legend .fd-ic { margin-right: calc(5 * var(--u)); vertical-align: -.15em }


/* ============================================================
   7. Portfolio (portfolio.css)
   The page's top: Add account, the three totals, and the Allocation card.
   Holding and Account regroup the same money (js/feature-demos.js). The
   donut is the app's too: the ring takes AntV's palette in the order of
   the holdings, biggest first, with a hairline between segments.
   Drawn 560 wide, one unit to the app's pixel at desktop width.
   ============================================================ */
.fd-pf { --u: calc(100cqw / 560) }
.fd-pf-stage {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  gap: calc(12 * var(--u));
  padding: calc(12 * var(--u));
}
.fd-pf-bar { display: flex; flex: none }
.fd-pf-stats { display: grid; flex: none; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: calc(12 * var(--u)) }
.fd-pf-card { display: flex; flex: 1; flex-direction: column; min-height: 0; overflow: hidden }
.fd-pf-card .fd-card-head { flex: none }
.fd-pf-view { display: flex; flex: 1; align-items: center; justify-content: center; gap: calc(44 * var(--u)); min-height: 0; padding: calc(10 * var(--u)) calc(16 * var(--u)) }
.fd-pf-view[hidden] { display: none }
.fd-donut { flex: none; width: calc(156 * var(--u)); height: calc(156 * var(--u)); overflow: visible }
.fd-donut-cap { fill: var(--fd-text-3); font-size: 9px; letter-spacing: .08em }
.fd-donut-total { fill: var(--fd-text); font-size: 16px; font-weight: 600 }
.fd-legend { display: flex; flex: 0 1 calc(230 * var(--u)); flex-direction: column; gap: calc(2 * var(--u)); min-width: 0; list-style: none }
.fd-legend li {
  display: grid;
  grid-template-columns: calc(8 * var(--u)) minmax(0, 1fr) auto calc(34 * var(--u));
  align-items: center;
  gap: calc(10 * var(--u));
  height: calc(30 * var(--u));
}
.fd-legend i { width: calc(8 * var(--u)); height: calc(8 * var(--u)); border-radius: 50%; background: var(--c) }
.fd-legend b { font-weight: 600; text-align: right; font-variant-numeric: tabular-nums }
/* a span, not <em>: the site paints every <em> with a green gradient fill */
.fd-legend .fd-pct { font-size: calc(12 * var(--u)); text-align: right; color: var(--fd-text-3) }


/* ============================================================
   8. The calendar (recurring.css)
   The Recurring page cut to its middle: the month's three totals, the
   first three weeks' Wednesday to Friday, and the list of schedules beside
   them. A chip is a button, and so is a list row. Pointing at either marks
   its whole schedule (the app's .rec-occ-active and .rec-rail-active, which
   is how a biweekly paycheck shows its run); pressing one holds the mark.
   In the app a press opens the schedule's editor, which a page cannot
   offer, so this one only keeps the mark.

   The stage is drawn 560 wide, the panel's widest, so at desktop width one
   unit is exactly one of the app's pixels. It is anchored right: when --u is
   floored on a phone it runs off the panel's left edge, and the list stays
   in view.
   ============================================================ */
.fd-rec { --u: max(.8px, calc(100cqw / 560)) }
.fd-rec-stage {
  position: absolute;
  top: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  gap: calc(12 * var(--u));
  width: calc(560 * var(--u));
  height: calc(420 * var(--u));
  padding: calc(12 * var(--u));
}
.fd-rec-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: calc(12 * var(--u)); flex: none }
.fd-rec-body { flex: 1; display: flex; gap: calc(12 * var(--u)); min-height: 0 }

/* the calendar: one ruled row per week, the date at its right */
.fd-rec-cal { flex: 1; min-width: 0; padding: calc(12 * var(--u)); overflow: hidden }
.fd-rec-weekdays,
.fd-rec-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) }
.fd-rec-weekdays span { padding: 0 calc(8 * var(--u)) calc(4 * var(--u)) 0; text-align: right; line-height: calc(18 * var(--u)) }
.fd-rec-day {
  display: flex;
  flex-direction: column;
  gap: calc(4 * var(--u));
  min-width: 0;
  min-height: calc(78 * var(--u));
  margin: 0 calc(3 * var(--u));
  padding: calc(4 * var(--u)) 0 0;
  border-top: calc(2 * var(--u)) solid var(--fd-split);
}
.fd-rec-today { border-top-color: var(--fd-primary) }
.fd-rec-num {
  align-self: flex-end;
  padding-right: calc(5 * var(--u));
  line-height: calc(24 * var(--u));
  font-variant-numeric: tabular-nums;
}
.fd-rec-outside .fd-rec-num { color: color-mix(in srgb, var(--app-text) 30%, transparent) }

/* the occurrence chip: a tile in its direction's stone, name over amount,
   white on it. Every state deepens the stone's own hue, so the white only
   ever gains contrast: hover, then marked, then pressed. */
.fd-occ {
  --hue: var(--fd-garnet);
  display: flex;
  flex-direction: column;
  width: 100%;
  min-width: 0;
  padding: calc(2 * var(--u)) calc(6 * var(--u));
  border: 0;
  border-radius: calc(4 * var(--u));
  background: var(--hue);
  font: inherit;
  font-size: calc(12 * var(--u));
  line-height: calc(16 * var(--u));
  text-align: left;
  color: #fff;
  cursor: pointer;
  transition: background-color .2s;
}
.fd-occ-income   { --hue: var(--fd-emerald) }
.fd-occ-transfer { --hue: var(--fd-lapis) }
.fd-occ-name,
.fd-occ-amount { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis }
.fd-occ-amount { font-weight: 600; font-variant-numeric: tabular-nums }
.fd-occ:hover { background: color-mix(in srgb, var(--hue) 88%, #000) }
.fd-occ.is-marked,
.fd-occ.is-marked:hover { background: color-mix(in srgb, var(--hue) 76%, #000); box-shadow: inset 0 0 0 1px rgb(255 255 255 / .5) }
.fd-occ:active { background: color-mix(in srgb, var(--hue) 68%, #000) }
/* white and inset: the accent on a saturated stone is near 1.6:1 */
.fd-occ:focus-visible { outline: 2px solid #fff; outline-offset: -2px }

/* the schedule list: who, how often and how much, and when it is next due */
.fd-rec-rail { flex: none; display: flex; flex-direction: column; width: calc(224 * var(--u)); overflow: hidden }
.fd-rec-rail .fd-card-head { flex: none }
.fd-rec-count { font-weight: 400; color: var(--fd-text-3) }
.fd-rec-list { display: flex; flex-direction: column; gap: calc(2 * var(--u)); padding: calc(4 * var(--u)) }
.fd-rail-row {
  display: flex;
  align-items: center;
  gap: calc(10 * var(--u));
  width: 100%;
  min-width: 0;
  padding: calc(8 * var(--u));
  border: 0;
  border-radius: calc(8 * var(--u));
  background: transparent;
  font: inherit;
  text-align: left;
  color: inherit;
  cursor: pointer;
  transition: background-color .2s;
}
.fd-rail-row:hover { background: var(--fd-fill-3) }
.fd-rail-row.is-marked,
.fd-rail-row.is-marked:hover { background: var(--fd-primary-bg) }
.fd-rail-row:active { background: var(--fd-fill-2) }
.fd-rail-row:focus-visible { outline: 2px solid var(--fd-primary); outline-offset: -2px }
.fd-rail-main { flex: 1; display: flex; flex-direction: column; min-width: 0 }
.fd-rail-name,
.fd-rail-sub { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis }
.fd-rail-sub { font-size: calc(12 * var(--u)); line-height: calc(20 * var(--u)); color: var(--fd-text-3) }
.fd-rail-next { display: flex; flex: none; align-items: center; gap: calc(7 * var(--u)) }
.fd-rail-date { font-variant-numeric: tabular-nums; white-space: nowrap; font-size: calc(13 * var(--u)) }
.fd-dot { width: calc(8 * var(--u)); height: calc(8 * var(--u)); border-radius: 50%; background: var(--fd-garnet) }
.fd-dot-income   { background: var(--fd-emerald) }
.fd-dot-transfer { background: var(--fd-lapis) }

/* @@SECTIONS-BELOW@@ */

@media (prefers-reduced-motion: reduce) {
  .fd-tx td, .fd-check, .fd-check::after, .fd-seg-item, .fd-sk-link, .fd-occ, .fd-rail-row, .fd-bub, .fd-stmt-grid th, .fd-stmt-grid td { transition: none }
}
