/* Investor portal (/idash). Self-contained: tailwind.css is prebuilt, so new UI uses these classes.
   Text colours are chosen for >= 4.5:1 on their surface in both themes; card gradients for white text. */

:root {
    --inv-bg: #fbfaf6;  /* soft warm ivory, same as the console */
    --inv-surface: #ffffff;
    --inv-surface-2: #f8fafc;
    --inv-line: #e5e7ef;
    --inv-ink: #0f172a;
    --inv-ink-2: #334155;
    --inv-ink-3: #5b6578;
    --inv-brand: #4e5893;          /* matte slate-indigo; white text on it is 6.6:1 */
    --inv-brand-hover: #434c80;
    --inv-brand-ink: #444d84;
    --inv-brand-soft: #eef0f6;
    --inv-ring: rgba(78, 88, 147, 0.3);
    --inv-good: #047857;
    --inv-good-soft: #ecfdf5;
    --inv-bad: #b42318;
    --inv-bad-soft: #fef3f2;
    --inv-shadow: 0 1px 2px rgba(15, 23, 42, 0.05), 0 8px 24px -16px rgba(15, 23, 42, 0.25);
}
.dark {
    --inv-bg: #0a0f1e;
    --inv-surface: #10172a;
    --inv-surface-2: #0d1426;
    --inv-line: #1f2a44;
    --inv-ink: #f1f5f9;
    --inv-ink-2: #cbd5e1;
    --inv-ink-3: #9aa6bb;
    --inv-brand-ink: #aab3e2;
    --inv-brand: #5b66a3;
    --inv-brand-hover: #67729f;
    --inv-brand-soft: rgba(91, 102, 163, 0.16);
    --inv-ring: rgba(170, 179, 226, 0.4);
    --inv-good: #4ade80;
    --inv-good-soft: rgba(34, 197, 94, 0.14);
    --inv-bad: #f87171;
    --inv-bad-soft: rgba(248, 113, 113, 0.14);
    --inv-shadow: 0 0 0 1px rgba(255, 255, 255, 0.03), 0 10px 30px -18px rgba(0, 0, 0, 0.8);
}

/* ── Page shell ─────────────────────────────────────────────────────────── */
.inv-body {
    min-height: 100vh; margin: 0; background: var(--inv-bg); color: var(--inv-ink-2);
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}
.inv-wash {
    position: absolute; inset: 0 0 auto 0; height: 26rem; z-index: 0; pointer-events: none;
    background:
        radial-gradient(40rem 18rem at 8% -10%, rgba(78, 88, 147, 0.08), transparent 70%),
        radial-gradient(34rem 16rem at 55% -20%, rgba(63, 111, 90, 0.06), transparent 70%),
        radial-gradient(30rem 16rem at 100% 0%, rgba(160, 87, 58, 0.05), transparent 70%);
}
.dark .inv-wash { opacity: 0.7; }
.inv-main { position: relative; z-index: 1; max-width: 1440px; margin: 0 auto; padding: 1.5rem 1rem 3rem; }
@media (min-width: 768px) { .inv-main { padding: 2rem 2rem 4rem; } }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* ── Header ─────────────────────────────────────────────────────────────── */
.inv-header {
    position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between;
    gap: 1rem; height: 4rem; padding: 0 1rem; border-bottom: 1px solid var(--inv-line);
    background: color-mix(in srgb, var(--inv-surface) 78%, transparent);
    backdrop-filter: saturate(1.6) blur(12px); -webkit-backdrop-filter: saturate(1.6) blur(12px);
}
@media (min-width: 768px) { .inv-header { padding: 0 2rem; } }
.inv-brand { display: inline-flex; align-items: center; gap: 0.625rem; text-decoration: none; color: var(--inv-ink); }
.inv-logo {
    display: inline-flex; align-items: center; justify-content: center; width: 2.125rem; height: 2.125rem;
    border-radius: 0.75rem; color: #fff; font-weight: 800; font-size: 0.95rem;
    background: var(--inv-brand);
}
.inv-brand-name { font-size: 0.95rem; font-weight: 800; letter-spacing: -0.01em; }
.inv-brand-tag {
    padding: 0.125rem 0.5rem; border-radius: 9999px; font-size: 10px; font-weight: 700; letter-spacing: 0.06em;
    text-transform: uppercase; color: var(--inv-brand-ink); background: var(--inv-brand-soft);
}
.inv-header-actions { display: flex; align-items: center; gap: 0.5rem; }
.inv-user { display: none; align-items: center; gap: 0.5rem; padding: 0.25rem 0.75rem 0.25rem 0.25rem; border-radius: 9999px; border: 1px solid var(--inv-line); background: var(--inv-surface); }
@media (min-width: 768px) { .inv-user { display: inline-flex; } }
.inv-avatar {
    display: inline-flex; align-items: center; justify-content: center; width: 1.75rem; height: 1.75rem;
    border-radius: 9999px; color: #fff; font-size: 0.75rem; font-weight: 800;
    background: var(--inv-brand);
}
.inv-user-name { font-size: 0.8125rem; font-weight: 600; color: var(--inv-ink); max-width: 14rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Buttons, chips, inputs ─────────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; height: 2.625rem;
    padding: 0 1.125rem; border-radius: 0.875rem; border: 1px solid transparent; cursor: pointer;
    font: inherit; font-size: 0.875rem; font-weight: 700; line-height: 1; text-decoration: none; white-space: nowrap;
    transition: transform 150ms ease, box-shadow 150ms ease, background-color 150ms ease, color 150ms ease, filter 150ms ease;
}
.btn svg { width: 1rem; height: 1rem; flex: none; }
.btn:focus-visible, .chip:focus-visible, .icon-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--inv-ring); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { cursor: not-allowed; opacity: 0.5; }
.btn-primary {
    color: #fff; background: var(--inv-brand);
}
.btn-primary:hover:not(:disabled) { background: var(--inv-brand-hover); }
.btn-ghost { color: var(--inv-ink-2); background: var(--inv-surface); border-color: var(--inv-line); }
.btn-ghost:hover:not(:disabled) { color: var(--inv-ink); background: var(--inv-surface-2); }
.icon-btn {
    display: inline-flex; align-items: center; justify-content: center; width: 2.25rem; height: 2.25rem;
    border-radius: 9999px; border: 1px solid var(--inv-line); background: var(--inv-surface); color: var(--inv-ink-3);
    cursor: pointer; transition: color 150ms ease, background-color 150ms ease;
}
.icon-btn:hover { color: var(--inv-ink); background: var(--inv-surface-2); }
.icon-btn svg { width: 1.125rem; height: 1.125rem; }
.icon-btn .hidden { display: none; }

.chips { display: flex; flex-wrap: wrap; gap: 0.375rem; padding: 0.25rem; border-radius: 1rem; background: var(--inv-surface-2); border: 1px solid var(--inv-line); }
.chip {
    height: 2rem; padding: 0 0.875rem; border: 0; border-radius: 0.75rem; cursor: pointer; background: transparent;
    font: inherit; font-size: 0.8125rem; font-weight: 600; color: var(--inv-ink-3); white-space: nowrap;
    transition: background-color 150ms ease, color 150ms ease, box-shadow 150ms ease;
}
.chip:hover { color: var(--inv-ink); }
.chip.is-active { color: #fff; background: var(--inv-brand); }

.field { display: flex; flex-direction: column; gap: 0.375rem; min-width: 0; }
.field-label { font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--inv-ink-3); }
.inv-input {
    height: 2.625rem; width: 100%; padding: 0 0.875rem; border-radius: 0.875rem; border: 1px solid var(--inv-line);
    background: var(--inv-surface-2); color: var(--inv-ink); font: inherit; font-size: 0.875rem; font-weight: 600;
    color-scheme: light; transition: border-color 150ms ease, box-shadow 150ms ease;
}
.dark .inv-input { color-scheme: dark; }
.inv-input:focus { outline: none; border-color: var(--inv-brand); box-shadow: 0 0 0 3px var(--inv-ring); }

/* ── Greeting + filter ──────────────────────────────────────────────────── */
.inv-hero { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem 1.5rem; margin-bottom: 1.25rem; }
.inv-hello { margin: 0; font-size: clamp(1.5rem, 3vw, 2rem); font-weight: 800; letter-spacing: -0.03em; color: var(--inv-ink); }
.inv-hello-wave { display: inline-block; transform-origin: 70% 70%; animation: inv-wave 1.8s ease-in-out 400ms 1; }
.inv-sub { margin: 0.25rem 0 0; font-size: 0.875rem; color: var(--inv-ink-3); }
.inv-sub strong { color: var(--inv-ink); font-weight: 700; }
.inv-hero-actions { display: flex; gap: 0.5rem; }

.inv-panel { border-radius: 1.25rem; border: 1px solid var(--inv-line); background: var(--inv-surface); box-shadow: var(--inv-shadow); }

/* Filter: quick ranges on the left, custom dates with Apply/Reset on the right; stacks when narrow. */
.inv-filter { display: flex; flex-direction: column; gap: 1rem; padding: 1rem; margin-bottom: 1.5rem; }
.inv-filter-quick { min-width: 0; }
.inv-filter .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.inv-filter .chips::-webkit-scrollbar { display: none; }
.inv-filter .chip { flex: none; }
.inv-filter-custom { display: flex; flex-direction: column; gap: 0.75rem; }
.inv-filter-dates { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; }
.inv-filter-actions { display: grid; grid-template-columns: 1fr auto; gap: 0.5rem; }
@media (min-width: 640px) {
    .inv-filter-custom { flex-direction: row; align-items: flex-end; }
    .inv-filter-dates { flex: 1 1 auto; }
    .inv-filter-actions { display: flex; }
}
@media (min-width: 1180px) {
    .inv-filter { flex-direction: row; align-items: flex-end; justify-content: space-between; gap: 1.5rem; padding: 1rem 1.25rem; }
    .inv-filter-custom { flex: 0 1 auto; padding-left: 1.5rem; border-left: 1px solid var(--inv-line); }
    .inv-filter-dates { grid-template-columns: repeat(2, 10.5rem); }
}
@media (max-width: 639px) {
    .inv-hero-actions { width: 100%; }
    .inv-hero-actions .btn { flex: 1 1 0; }
}

.inv-alert {
    display: flex; align-items: center; gap: 0.625rem; padding: 0.875rem 1rem; margin-bottom: 1.25rem; border-radius: 1rem;
    font-size: 0.875rem; font-weight: 600; color: var(--inv-bad); background: var(--inv-bad-soft); border: 1px solid color-mix(in srgb, var(--inv-bad) 25%, transparent);
}
.inv-alert svg { width: 1.125rem; height: 1.125rem; flex: none; }
/* Loading: a centred pill above the placeholder cards. Present, but no louder than a button. */
.inv-loading {
    display: flex; align-items: center; justify-content: center; gap: 0.625rem; width: fit-content; min-width: 16rem;
    margin: 0.25rem auto 1.25rem; padding: 0.625rem 1.25rem; border-radius: 9999px;
    border: 1px solid var(--inv-line); background: color-mix(in srgb, var(--inv-surface) 85%, transparent);
    backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
    font-size: 0.9375rem; font-weight: 700; color: var(--inv-ink);
}
.inv-loading svg { width: 1.25rem; height: 1.25rem; flex: none; color: var(--inv-brand); animation: inv-spin 0.9s linear infinite; }
.dark .inv-loading svg { color: var(--inv-brand-ink); }

/* ── Cards (matte) ──────────────────────────────────────────────────────── */
/* Each card has one muted accent (--kpi-matte): a faint wash, the icon tint and the figure.
   Dark mode swaps in a lighter step of the same hue so figures keep >= 4.5:1. */
.kpi-grid { display: grid; gap: 1rem; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 640px) { .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .kpi-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
/* Main view, five cards: the three money cards on top, then Terminals (two columns) beside Total share.
   With two columns, dense packing pulls Total share up beside GGR and Terminals takes its own row. */
@media (min-width: 640px) {
    .kpi-grid-main { grid-auto-flow: row dense; }
    .kpi-grid-main > :nth-child(4) { grid-column: span 2; }
}
@media (min-width: 1100px) { .kpi-grid-main { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.kpi-collection { --kpi-matte: #3f6f5a; --kpi-matte-dark: #93c3ab; }
.kpi-wins { --kpi-matte: #a0573a; --kpi-matte-dark: #dea183; }
.kpi-ggr { --kpi-matte: #4e5893; --kpi-matte-dark: #aab3e2; }
.kpi-ggr-loss { --kpi-matte: #9e4540; --kpi-matte-dark: #e3958e; }
.kpi-share { --kpi-matte: #94506b; --kpi-matte-dark: #d9a0b6; }
.kpi-avg { --kpi-matte: #55606f; --kpi-matte-dark: #a7b0bd; }
.kpi-terminals { --kpi-matte: #3d6987; --kpi-matte-dark: #93b8d2; }
.kpi-pool { --kpi-matte: #6c5a88; --kpi-matte-dark: #bfb0da; }
.kpi-total { --kpi-matte: #85692e; --kpi-matte-dark: #d8bf86; }
.dark .kpi { --kpi-matte: var(--kpi-matte-dark); }
.kpi {
    position: relative; overflow: hidden; isolation: isolate; min-width: 0;
    display: flex; flex-direction: column; gap: 0.5rem; padding: 1.25rem 1.25rem 1.125rem;
    border-radius: 1.25rem; color: var(--inv-ink);
    background: color-mix(in srgb, var(--kpi-matte) 6%, var(--inv-surface));
    border: 1px solid color-mix(in srgb, var(--kpi-matte) 16%, var(--inv-line));
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    transition: transform 200ms ease, box-shadow 200ms ease;
    animation: kpi-rise 520ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.dark .kpi { background: color-mix(in srgb, var(--kpi-matte) 7%, var(--inv-surface)); box-shadow: none; }
.kpi:nth-child(2) { animation-delay: 70ms; }
.kpi:nth-child(3) { animation-delay: 140ms; }
.kpi:nth-child(4) { animation-delay: 210ms; }
.kpi:nth-child(5) { animation-delay: 280ms; }
.kpi:nth-child(6) { animation-delay: 350ms; }
.kpi:nth-child(7) { animation-delay: 420ms; }
.kpi:nth-child(8) { animation-delay: 490ms; }
.kpi:hover { transform: translateY(-1px); box-shadow: 0 4px 14px -8px rgba(15, 23, 42, 0.18); }
.kpi-head { display: flex; align-items: center; gap: 0.625rem; }
.kpi-icon {
    display: inline-flex; align-items: center; justify-content: center; flex: none;
    width: 2.25rem; height: 2.25rem; border-radius: 0.75rem;
    color: var(--kpi-matte); background: color-mix(in srgb, var(--kpi-matte) 14%, transparent);
}
.kpi-icon svg { width: 1.125rem; height: 1.125rem; }
.kpi-label { margin: 0; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--inv-ink-3); }
.kpi-value { margin: 0.25rem 0 0; display: flex; align-items: baseline; flex-wrap: wrap; column-gap: 0.25rem; font-variant-numeric: tabular-nums; line-height: 1.1; white-space: nowrap; }
.kpi-currency { align-self: flex-start; margin-top: 0.3rem; margin-right: 0.125rem; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.04em; color: var(--inv-ink-3); }
.kpi-num { font-size: clamp(1.75rem, 2.6vw, 2.25rem); font-weight: 800; letter-spacing: -0.03em; color: var(--kpi-matte); }
.kpi-cents, .kpi-of { font-weight: 700; color: var(--inv-ink-3); }
.kpi-cents { font-size: 1rem; }
.kpi-of { font-size: 1.125rem; }
/* Terminals card: the active-rate sub line and the pool add-on in the Active legend row. */
.kpi-sub { margin: 0; font-size: 12px; color: var(--inv-ink-3); font-variant-numeric: tabular-nums; }
.kpi-legend-pool { font-weight: 700; color: var(--kpi-matte); }
.kpi-legend.has-pool { grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr)); }  /* "3,270 (1,450)" needs a wider row */
.kpi-legend b { white-space: nowrap; }
.kpi-note { margin: auto 0 0; padding-top: 0.625rem; border-top: 1px solid color-mix(in srgb, var(--kpi-matte) 14%, var(--inv-line)); font-size: 11px; font-weight: 500; color: var(--inv-ink-3); }
.kpi-skeleton { min-height: 9.5rem; border-radius: 1.25rem; background: linear-gradient(90deg, #e9ecf2 0%, #f3f5f8 50%, #e9ecf2 100%); background-size: 200% 100%; animation: kpi-shimmer 1.4s linear infinite; }
.dark .kpi-skeleton { background-image: linear-gradient(90deg, #10172a 0%, #18213a 50%, #10172a 100%); }

/* Terminals card: a segmented bar and a legend of states. */
.kpi-segments { display: flex; gap: 2px; height: 0.5rem; border-radius: 9999px; overflow: hidden; background: color-mix(in srgb, var(--kpi-matte) 12%, var(--inv-line)); }
.kpi-segments .seg { height: 100%; min-width: 0; transition: width 700ms cubic-bezier(0.2, 0.8, 0.2, 1); transform-origin: left; animation: kpi-grow 900ms 250ms cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.kpi-segments .seg[hidden] { display: none; }
.seg-active { background: var(--kpi-matte); }
.seg-deployed { background: #6f9e88; }
.seg-maintenance { background: #c39a52; }
.seg-available { background: #a3abb7; }
.seg-other { background: #cdd2da; }
.kpi-legend { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.25rem 0.75rem; margin: 0.25rem 0 0; padding: 0; list-style: none; font-size: 11px; color: var(--inv-ink-2); }
.kpi-legend li { display: flex; align-items: center; gap: 0.375rem; min-width: 0; }
.kpi-legend i { width: 0.5rem; height: 0.5rem; border-radius: 2px; flex: none; }
.kpi-legend b { margin-left: auto; font-weight: 800; color: var(--inv-ink); font-variant-numeric: tabular-nums; }

/* ── Live (matte brick) ─────────────────────────────────────────────────── */
:root { --live: #9e4540; --live-soft: #f6ecea; }
.dark { --live: #e3958e; --live-soft: rgba(227, 149, 142, 0.12); }
.btn-live { position: relative; color: var(--live); background: var(--live-soft); border-color: transparent; padding-right: 0.875rem; }
.btn-live:hover { filter: brightness(0.97); }
.live-dot { position: relative; width: 0.5rem; height: 0.5rem; border-radius: 9999px; background: currentColor; }
.btn-live.is-on { color: #fff; background: #9e4540; }
.btn-live.is-on .live-dot { background: #fff; }
.btn-live.is-on .live-dot::after {
    content: ""; position: absolute; inset: 0; border-radius: 9999px; background: #fff;
    animation: kpi-ping 1.4s cubic-bezier(0, 0, 0.2, 1) infinite;
}
.live-ring { width: 1.125rem; height: 1.125rem; transform: rotate(-90deg); display: none; }
.btn-live.is-on .live-ring { display: block; }
.live-ring circle { fill: none; stroke-width: 2.5; stroke: rgba(255, 255, 255, 0.3); }
.live-ring .live-ring-fill {
    stroke: #fff; stroke-linecap: round; stroke-dasharray: 50.27;
    stroke-dashoffset: calc(50.27 * (1 - var(--live-progress, 0))); transition: stroke-dashoffset 1s linear;
}

.live-banner {
    position: relative; overflow: hidden; display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem;
    padding: 0.875rem 1.125rem; border-radius: 1.25rem; color: var(--inv-ink);
    background: color-mix(in srgb, var(--live) 7%, var(--inv-surface));
    border: 1px solid color-mix(in srgb, var(--live) 18%, var(--inv-line));
    animation: kpi-rise 420ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.live-banner::after {
    content: ""; position: absolute; inset: 0; pointer-events: none;
    background: linear-gradient(100deg, transparent 20%, color-mix(in srgb, var(--live) 12%, transparent) 50%, transparent 80%);
    transform: translateX(-120%);
}
.live-banner.is-fresh::after { animation: kpi-sheen 1.1s ease-out; }
.live-banner.is-refreshing .live-eq i { animation-duration: 0.45s; }
.live-banner-text { min-width: 0; }
.live-title { margin: 0; font-size: 0.9375rem; font-weight: 800; letter-spacing: -0.01em; color: var(--live); }
.live-sub { margin: 0.125rem 0 0; font-size: 12px; color: var(--inv-ink-3); font-variant-numeric: tabular-nums; }
.live-sep { margin: 0 0.375rem; opacity: 0.6; }
.live-radar { position: relative; flex: none; width: 2.5rem; height: 2.5rem; }
.live-radar i { position: absolute; inset: 0; margin: auto; border-radius: 9999px; border: 2px solid var(--live); animation: live-radar 2.4s cubic-bezier(0, 0, 0.2, 1) infinite; }
.live-radar i:nth-child(2) { animation-delay: 0.8s; }
.live-radar i:nth-child(3) { animation-delay: 1.6s; }
.live-radar::after { content: ""; position: absolute; inset: 0; margin: auto; width: 0.75rem; height: 0.75rem; border-radius: 9999px; background: var(--live); }
.live-eq { margin-left: auto; display: inline-flex; align-items: flex-end; gap: 3px; height: 1.25rem; }
.live-eq i { width: 3px; height: 100%; border-radius: 2px; background: color-mix(in srgb, var(--live) 70%, transparent); transform-origin: bottom; animation: live-eq 1.1s ease-in-out infinite; }
.live-eq i:nth-child(2) { animation-delay: -0.3s; }
.live-eq i:nth-child(3) { animation-delay: -0.6s; }
.live-eq i:nth-child(4) { animation-delay: -0.15s; }
.live-eq i:nth-child(5) { animation-delay: -0.45s; }

/* New figures: a soft sweep in the card's accent and a floating change chip. */
.kpi-delta {
    position: absolute; right: 1rem; top: 3.75rem; z-index: 2; padding: 0.25rem 0.5rem; border-radius: 9999px;
    font-size: 12px; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--kpi-matte);
    background: var(--inv-surface); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--kpi-matte) 30%, var(--inv-line));
    animation: kpi-float 2.6s cubic-bezier(0.2, 0.8, 0.2, 1) forwards; pointer-events: none;
}
.kpi.is-updated { animation: kpi-pop 600ms cubic-bezier(0.2, 0.8, 0.2, 1) var(--sheen-delay, 0ms) both; }
.kpi .kpi-head::after {
    content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none; border-radius: inherit;
    background: linear-gradient(100deg, transparent 25%, color-mix(in srgb, var(--kpi-matte) 14%, transparent) 50%, transparent 75%);
    transform: translateX(-130%);
}
.kpi.is-updated .kpi-head::after { animation: kpi-sheen 1.2s ease-out var(--sheen-delay, 0ms); }

.live-toast {
    position: fixed; right: 1rem; bottom: 1rem; z-index: 60; padding: 0.75rem 1rem; border-radius: 1rem;
    font-size: 0.875rem; font-weight: 700; color: #fff; background: #0f172a; box-shadow: 0 18px 40px -16px rgba(2, 6, 23, 0.7);
    transform: translateY(1.5rem); opacity: 0;
}
.dark .live-toast { background: #f1f5f9; color: #0f172a; }
.live-toast.is-showing { animation: live-toast 3.6s cubic-bezier(0.2, 0.8, 0.2, 1) forwards; }
body.is-live .inv-filter-dates, body.is-live .chips { opacity: 0.55; transition: opacity 200ms ease; }

.inv-loading-text { display: inline-block; min-width: 13ch; text-align: center; transition: opacity 220ms ease, transform 220ms ease; }
.inv-loading-text.is-leaving { opacity: 0; transform: translateY(-4px); }

/* ── Deals by PLO ───────────────────────────────────────────────────────── */
.inv-deals { margin-top: 1.5rem; padding: 1.25rem 1.25rem 1rem; animation: kpi-rise 520ms 250ms cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.inv-deals-title { margin: 0 0 0.75rem; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--inv-ink-3); }
.inv-deals-wrap { overflow-x: auto; }
.inv-deals table { width: 100%; border-collapse: collapse; font-size: 12.5px; font-variant-numeric: tabular-nums; color: var(--inv-ink-2); }
.inv-deals th { padding: 0.5rem 0.75rem; text-align: right; white-space: nowrap; font-size: 10.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--inv-ink-3); border-bottom: 1px solid var(--inv-line); }
.inv-deals td { padding: 0.625rem 0.75rem; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--inv-line); }
.inv-deals :is(th, td):first-child { text-align: left; }
.inv-deals tfoot td { font-weight: 800; color: var(--inv-ink); border-bottom: 0; }
.inv-deals .deal-plo { font-weight: 700; color: var(--inv-ink); }
.inv-deals .deal-rate { display: inline-block; min-width: 3.5rem; padding: 0.125rem 0.5rem; border-radius: 9999px; font-weight: 700; color: var(--inv-brand-ink); background: var(--inv-brand-soft); }
.inv-deals .deal-rate.is-off { color: var(--inv-ink-3); background: var(--inv-surface-2); font-weight: 600; }
.inv-deals .deal-strong { font-weight: 800; color: var(--inv-ink); }
.inv-deals .deal-none { color: var(--inv-ink-3); }

/* ── Terminal list (under the cards) ────────────────────────────────────── */
.inv-list { margin-top: 1.5rem; padding: 1.25rem 1rem 1.5rem; animation: kpi-rise 520ms 300ms cubic-bezier(0.2, 0.8, 0.2, 1) both; }

.is-negative { color: var(--inv-bad) !important; }

.status-pill { display: inline-flex; align-items: center; gap: 0.375rem; padding: 0.125rem 0.5rem; border-radius: 9999px; font-size: 11px; font-weight: 700; color: var(--inv-ink-3); background: var(--inv-surface-2); border: 1px solid var(--inv-line); }
.status-pill::before { content: ""; width: 0.375rem; height: 0.375rem; border-radius: 9999px; background: currentColor; }
.status-pill.is-deployed { color: var(--inv-ink-2); }

/* DataTables, restyled to match. */
.inv-table-wrap { overflow-x: auto; }
#terminal-list-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12.5px; color: var(--inv-ink-2); }
#terminal-list-table th, #terminal-list-table td { white-space: nowrap; font-variant-numeric: tabular-nums; padding: 0.75rem 0.625rem; border-color: var(--inv-line) !important; }
#terminal-list-table thead th {
    text-align: left; cursor: move; font-size: 10.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
    color: var(--inv-ink-3); background: var(--inv-surface-2) !important; border-bottom: 1px solid var(--inv-line) !important;
}
#terminal-list-table thead th:first-child { border-top-left-radius: 0.75rem; }
#terminal-list-table thead th:last-child { border-top-right-radius: 0.75rem; }
#terminal-list-table thead th.dt-right, #terminal-list-table tfoot th.dt-right { text-align: right; padding-right: 1.5rem; }
#terminal-list-table tbody td.dt-right { padding-right: 1.5rem; }
#terminal-list-table tbody td.sorting_1 { background: color-mix(in srgb, var(--inv-brand-soft) 60%, transparent) !important; }
#terminal-list-table tbody tr { background: transparent !important; transition: background-color 120ms ease; }
#terminal-list-table tbody tr:hover { background: var(--inv-brand-soft) !important; }
#terminal-list-table tbody td { border-top: 1px solid var(--inv-line); }
#terminal-list-table .cell-strong { font-weight: 700; color: var(--inv-ink); }
#terminal-list-table .cell-mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; color: var(--inv-ink); }
#terminal-list-table tfoot th { font-weight: 800; color: var(--inv-ink); background: var(--inv-surface-2) !important; border-top: 2px solid var(--inv-line) !important; }
table.dataTable.no-footer { border-bottom-color: var(--inv-line) !important; }
.dataTables_wrapper { font-size: 0.8125rem; color: var(--inv-ink-3); }
.dataTables_wrapper .dataTables_info, .dataTables_wrapper .dataTables_paginate { margin-top: 1rem; color: var(--inv-ink-3) !important; }
.dataTables_wrapper .dataTables_filter { margin-bottom: 1rem; }
.dataTables_wrapper .dataTables_filter input {
    height: 2.375rem; min-width: 15rem; margin-left: 0; padding: 0 0.875rem 0 2.25rem; border-radius: 0.875rem;
    border: 1px solid var(--inv-line); color: var(--inv-ink); font: inherit; font-size: 0.8125rem;
    background: var(--inv-surface-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") no-repeat 0.75rem center / 1rem;
}
.dataTables_wrapper .dataTables_filter input:focus { outline: none; border-color: var(--inv-brand); box-shadow: 0 0 0 3px var(--inv-ring); }
.dataTables_wrapper .dataTables_length { margin: 0 0 1rem 0.75rem; display: inline-block; }
.dataTables_wrapper .dataTables_length select {
    height: 2.375rem; margin: 0 0.375rem; padding: 0 0.5rem; border-radius: 0.875rem;
    border: 1px solid var(--inv-line); color: var(--inv-ink); font: inherit; font-size: 0.8125rem; background: var(--inv-surface-2);
}
.dataTables_wrapper .dataTables_processing {
    top: 3.5rem; margin-top: 0; padding: 0.5rem 1rem; border-radius: 0.875rem; font-weight: 700; color: var(--inv-ink);
    background: var(--inv-surface) !important; border: 1px solid var(--inv-line); box-shadow: none;
}
.dataTables_wrapper .dataTables_processing > div:last-child { display: none; }
.dataTables_wrapper .dt-buttons { margin-bottom: 1rem; display: inline-flex; flex-wrap: wrap; gap: 0.375rem; }
.dataTables_wrapper .dt-buttons .dt-button {
    margin: 0 !important; height: 2.375rem; padding: 0 0.875rem !important; border-radius: 0.875rem !important;
    border: 1px solid var(--inv-line) !important; background: var(--inv-surface) !important; color: var(--inv-ink-2) !important;
    font: inherit; font-size: 0.8125rem !important; font-weight: 700 !important; box-shadow: none !important;
}
.dataTables_wrapper .dt-buttons .dt-button:hover { background: var(--inv-surface-2) !important; color: var(--inv-ink) !important; }
.dataTables_wrapper .dataTables_paginate .paginate_button {
    min-width: 2.125rem; margin: 0 0.125rem !important; padding: 0.375rem 0.75rem !important; border-radius: 0.75rem !important;
    border: 1px solid transparent !important; color: var(--inv-ink-2) !important; font-weight: 600;
}
.dataTables_wrapper .dataTables_paginate .paginate_button:hover { background: var(--inv-surface-2) !important; border-color: var(--inv-line) !important; color: var(--inv-ink) !important; }
.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
    color: #fff !important; border-color: transparent !important;
    background: var(--inv-brand) !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled { opacity: 0.4; }
div.dt-button-collection { padding: 0.375rem !important; border-radius: 0.875rem !important; background: var(--inv-surface) !important; border: 1px solid var(--inv-line) !important; }
div.dt-button-collection .dt-button { border-radius: 0.625rem !important; }

/* ── Motion ─────────────────────────────────────────────────────────────── */
@keyframes kpi-rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes kpi-ping { 75%, 100% { transform: scale(2.4); opacity: 0; } }
@keyframes kpi-grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes kpi-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@keyframes inv-spin { to { transform: rotate(360deg); } }
@keyframes kpi-sheen { from { transform: translateX(-130%); } to { transform: translateX(130%); } }
@keyframes kpi-pop { 0% { transform: none; } 35% { transform: translateY(-4px) scale(1.015); } 100% { transform: none; } }
@keyframes kpi-float { 0% { opacity: 0; transform: translateY(8px) scale(0.9); } 15% { opacity: 1; transform: none; } 75% { opacity: 1; } 100% { opacity: 0; transform: translateY(-22px); } }
@keyframes live-radar { 0% { transform: scale(0.3); opacity: 1; } 100% { transform: scale(1.15); opacity: 0; } }
@keyframes live-eq { 0%, 100% { transform: scaleY(0.3); } 50% { transform: scaleY(1); } }
@keyframes live-toast { 0% { opacity: 0; transform: translateY(1.5rem); } 10%, 85% { opacity: 1; transform: none; } 100% { opacity: 0; transform: translateY(0.5rem); } }
@keyframes inv-wave { 0%, 60%, 100% { transform: rotate(0); } 10%, 30% { transform: rotate(14deg); } 20% { transform: rotate(-8deg); } 40% { transform: rotate(-4deg); } 50% { transform: rotate(10deg); } }
@media (prefers-reduced-motion: reduce) {
    .kpi, .kpi.is-updated, .inv-list, .inv-deals, .kpi-segments .seg, .kpi-skeleton, .inv-hello-wave,
    .inv-loading svg, .btn-live.is-on .live-dot::after, .live-banner, .live-radar i, .live-eq i,
    .kpi.is-updated .kpi-head::after, .live-banner.is-fresh::after { animation: none; }
    .live-toast.is-showing { animation: none; opacity: 1; transform: none; }
    .kpi-segments .seg, .live-ring .live-ring-fill { transition: none; }
    .kpi, .btn, .chip { transition: none; }
    .kpi:hover { transform: none; }
}

/* ── Background motifs (console-decor.js, shared with the back-office console) ── */
#c-decor { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
#c-decor svg { position: absolute; }
@media print { #c-decor { display: none; } }

/* Terminal list status filter and state pills (states as on the Terminals card) */
.inv-list-filter { display: flex; justify-content: flex-start; margin: 0 0.75rem 1rem; }
.inv-list-filter .field { width: 100%; max-width: 16rem; }
.status-pill.is-active { color: var(--inv-good); background: var(--inv-good-soft); border-color: transparent; }
/* Deals by PLO: dates of a deal that starts or ends inside the range, and rates that changed */
.inv-deals .deal-dates { display: block; margin-top: 0.125rem; font-size: 11px; font-weight: 500; color: var(--inv-ink-3); }
.inv-deals .deal-rate.is-changed { cursor: help; }

/* ── Superuser preview bar (templates/investor/_preview_bar.html) ───────── */
.inv-preview { position: relative; z-index: 15; border-bottom: 1px solid var(--inv-line); background: var(--inv-brand-soft); }
.inv-preview-inner {
    display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.875rem; max-width: 1440px; margin: 0 auto;
    padding: 0.625rem 1rem;
}
@media (min-width: 768px) { .inv-preview-inner { padding: 0.625rem 2rem; } }
.inv-preview-tag {
    display: inline-flex; align-items: center; gap: 0.375rem; font-size: 11px; font-weight: 800; letter-spacing: 0.06em;
    text-transform: uppercase; color: var(--inv-brand-ink);
}
.inv-preview-tag svg { width: 1rem; height: 1rem; flex: none; }
.inv-preview-form { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; flex: 1 1 22rem; min-width: 0; }
.inv-preview-form .inv-input { height: 2.25rem; background: var(--inv-surface); }
.inv-preview-search { flex: 1 1 10rem; max-width: 14rem; }
.inv-preview-select { flex: 1 1 12rem; max-width: 22rem; width: auto; }
.inv-preview-go { height: 2.25rem; }
.inv-preview-note { font-size: 0.8125rem; font-weight: 600; color: var(--inv-ink-3); }
@media (max-width: 639px) {
    .inv-preview-search, .inv-preview-select { max-width: none; flex-basis: 100%; }
}
