/* ------------------------------------------------------------------ Tile marks (ci-tile-mark)
   One recipe for every KPI tile's watermark: the tile's metric glyph sits large, angled and see-through in its lower
   right corner, cut off by the tile's edge, filled with a gradient of the tile's own hue (strong at the top left, fading
   out toward the corner). The hue is --ci-mark: a ci-mark-<hue> class sets it, or the tile's own tone variable does
   (Transactions --tone). Used by the Transactions insight strip, the liabilities KPI tiles (Credit Cards and the other
   sub-pages) and InvestmentStatTile (Holdings, Performance, Activity, Overview, Dividends...). Decorative only: the
   markup carries aria-hidden. Loaded after the area sheets so its sizes win ties. */

.ci-tile-marked {
    position: relative;
    overflow: hidden;
    isolation: isolate;
}

.ci-tile-mark {
    --ci-mark-fill: linear-gradient(140deg,
        var(--ci-mark, currentColor) 12%,
        color-mix(in srgb, var(--ci-mark, currentColor) 55%, transparent) 55%,
        color-mix(in srgb, var(--ci-mark, currentColor) 18%, transparent) 100%);
    position: absolute;
    right: var(--ci-mark-right, -10px);
    bottom: var(--ci-mark-bottom, -16px);
    z-index: -1;
    display: block;
    font-size: var(--ci-mark-size, 66px);
    line-height: 1;
    color: var(--ci-mark, currentColor);
    opacity: .17;
    transform: rotate(-14deg);
    transform-origin: 65% 65%;
    pointer-events: none;
    user-select: none;
    transition: opacity .22s ease, transform .3s cubic-bezier(.2, .8, .2, 1);
}

/* The gradient fill where the browser can clip a background to a glyph; a flat tint everywhere else. */
@supports ((-webkit-background-clip: text) or (background-clip: text)) {
    .ci-tile-mark {
        background: var(--ci-mark-fill);
        -webkit-background-clip: text;
        background-clip: text;
        -webkit-text-fill-color: transparent;
    }
}

[data-bs-theme="dark"] .ci-tile-mark { opacity: .22; }

.ci-tile-marked:hover > .ci-tile-mark { opacity: .25; transform: rotate(-8deg) scale(1.05); }
[data-bs-theme="dark"] .ci-tile-marked:hover > .ci-tile-mark { opacity: .3; }

@media (prefers-reduced-motion: reduce) {
    .ci-tile-mark { transition: none; }
    .ci-tile-marked:hover > .ci-tile-mark { transform: rotate(-14deg); }
}

/* ---- Hues (the one-hue-per-meaning palette, tuned separately for light and dark) */
.ci-mark-green  { --ci-mark: #16A34A; }
.ci-mark-red    { --ci-mark: #DC2626; }
.ci-mark-rose   { --ci-mark: #EF4444; }
.ci-mark-amber  { --ci-mark: #D97706; }
.ci-mark-blue   { --ci-mark: #2563EB; }
.ci-mark-sky    { --ci-mark: #0284C7; }
.ci-mark-teal   { --ci-mark: #0D9488; }
.ci-mark-indigo { --ci-mark: #4F46E5; }
.ci-mark-violet { --ci-mark: #7C3AED; }

[data-bs-theme="dark"] .ci-mark-green  { --ci-mark: #34D399; }
[data-bs-theme="dark"] .ci-mark-red    { --ci-mark: #F87171; }
[data-bs-theme="dark"] .ci-mark-rose   { --ci-mark: #FB7185; }
[data-bs-theme="dark"] .ci-mark-amber  { --ci-mark: #F2B557; }
[data-bs-theme="dark"] .ci-mark-blue   { --ci-mark: #60A5FA; }
[data-bs-theme="dark"] .ci-mark-sky    { --ci-mark: #38BDF8; }
[data-bs-theme="dark"] .ci-mark-teal   { --ci-mark: #2DD4BF; }
[data-bs-theme="dark"] .ci-mark-indigo { --ci-mark: #A5B4FC; }
[data-bs-theme="dark"] .ci-mark-violet { --ci-mark: #C4B5FD; }

/* ---- Transactions insight strip: the tile's own --tone is the hue. */
.txi-tile > .ci-tile-mark {
    --ci-mark: var(--tone);
    --ci-mark-size: 76px;
    --ci-mark-right: -12px;
    --ci-mark-bottom: -20px;
}
.txv[data-bp="xs"] .txi-tile > .ci-tile-mark { --ci-mark-size: 58px; }

/* ---- Liabilities KPI tiles (Credit Cards and the other sub-pages): a step up from the AI metric watermark. */
.lb-stat > .ci-tile-mark {
    --ci-mark-size: 74px;
    --ci-mark-right: -12px;
    --ci-mark-bottom: -20px;
}
.lb-stat.is-hero > .ci-tile-mark {
    --ci-mark-size: 96px;
    --ci-mark-right: -14px;
    --ci-mark-bottom: -26px;
}

/* ---- InvestmentStatTile: the tiles are shorter than the other areas', so the mark sits higher; a tile narrower
   than about 175px (the same break that hides its chip) takes a smaller one. */
.iv-stat > .ci-tile-mark {
    --ci-mark-size: 68px;
    --ci-mark-right: -10px;
    --ci-mark-bottom: -12px;
}

@container iv-stat (max-width: 175px) {
    .iv-stat > .ci-tile-mark {
        --ci-mark-size: 50px;
        --ci-mark-right: -8px;
        --ci-mark-bottom: -10px;
    }
}

/* ---- Recurring Pulse tiles (Monthly, Could save, To review): the tile's own tone, as its glyph chip uses. */
.rc-tile > .ci-tile-mark {
    --ci-mark: var(--tx-primary);
    --ci-mark-size: 84px;
    --ci-mark-right: -12px;
    --ci-mark-bottom: -22px;
}
.rc-tile-positive > .ci-tile-mark { --ci-mark: var(--tx-positive); }
.rc-tile-caution > .ci-tile-mark { --ci-mark: var(--tx-caution); }
.rc-tile-critical > .ci-tile-mark { --ci-mark: var(--tx-critical); }
/* ---- Every other tile family uses the base size (66px); these step it up or down to the tile's own height. */
/* Short, wide tiles (the income history figures, the market data chips): a smaller mark that still clears the text. */
.ivd-tiles .iv-stat > .ci-tile-mark { --ci-mark-size: 48px; --ci-mark-right: -6px; --ci-mark-bottom: -10px; }
.ivo-qchip > .ci-tile-mark { --ci-mark-size: 46px; --ci-mark-right: -6px; --ci-mark-bottom: -10px; }
/* The big Today's movers cards. */
.ivo-mover > .ci-tile-mark { --ci-mark-size: 92px; --ci-mark-right: -14px; --ci-mark-bottom: -22px; }
/* The account heroes' tall tiles (My Accounts, Partner Sharing, Update Account) and the report heroes. */
.mya-stat > .ci-tile-mark,
.psh-stat > .ci-tile-mark,
.upa-stat > .ci-tile-mark { --ci-mark-size: 74px; --ci-mark-right: -12px; --ci-mark-bottom: -18px; }
.hx-metric > .ci-tile-mark { --ci-mark-size: 62px; --ci-mark-right: -10px; --ci-mark-bottom: -16px; }
.rp-stat > .ci-tile-mark { --ci-mark-size: 62px; --ci-mark-right: -10px; --ci-mark-bottom: -16px; }
.ivd-glass > .ci-tile-mark,
.dbx-metric > .ci-tile-mark { --ci-mark-size: 58px; --ci-mark-right: -8px; --ci-mark-bottom: -14px; }
/* Dashboard (modern): Cash flow ahead's Income / Bills / Low point, and Where your money goes' Spent / Came in / Net / Saved. */
.dx-stat > .ci-tile-mark { --ci-mark-size: 56px; --ci-mark-right: -8px; --ci-mark-bottom: -14px; }
.dx-kpi > .ci-tile-mark { --ci-mark-size: 54px; --ci-mark-right: -6px; --ci-mark-bottom: -14px; }
/* Dashboard (modern): Settle up's two sides (You owe / owes you). */
.dx-side > .ci-tile-mark { --ci-mark-size: 58px; --ci-mark-right: -8px; --ci-mark-bottom: -16px; }
/* The chart popups' tiles (series-chart.js, security-chart.js islands): a tile with a line's color or a named tone
   (no ci-mark class) takes the tile's own icon color. */
.scx-tile > .ci-tile-mark,
.rcx-tile > .ci-tile-mark { --ci-mark-size: 46px; --ci-mark-right: -6px; --ci-mark-bottom: -12px; }
.scx-tile > .ci-tile-mark:not([class*="ci-mark-"]) { --ci-mark: var(--scx-ico); }
.rcx-tile > .ci-tile-mark:not([class*="ci-mark-"]) { --ci-mark: var(--rcx-ico); }
/* Dividends hero: Where your income leads' three figures (the Net Worth pace pane's tiles). */
.ivd-pace-tile > .ci-tile-mark { --ci-mark-size: 44px; --ci-mark-right: -6px; --ci-mark-bottom: -10px; }
/* Reports Overview: This month's pace figures (Spent so far / Still to come / Last month), as the Net Worth pace tiles. */
.rp-pace2-legend > div > .ci-tile-mark { --ci-mark-size: 44px; --ci-mark-right: -6px; --ci-mark-bottom: -10px; }
.hx.has-side .hx-side.rp-pace2 .rp-pace2-legend > div > .ci-tile-mark { --ci-mark-size: 54px; --ci-mark-right: -8px; --ci-mark-bottom: -12px; }/* Budgets: the Forecast card's four figures (Period ends at / Ending over / Carries forward / Same period last year). */
.bg-stat > .ci-tile-mark { --ci-mark-size: 56px; --ci-mark-right: -8px; --ci-mark-bottom: -14px; }
