/* Institutional Flows (public/fiidii.js). Participant colours = categorical slots 1-4 (blue, orange, aqua, yellow). */
#tab-fiidii-view {
  --fd-fii: #257de0; --fd-dii: #f47230; --fd-pro: #00b894; --fd-client: #f2a600;
  --fd-up: var(--bullish, #15803d); --fd-dn: var(--bearish, #dc2626);
  --fd-ink: var(--foreground, #191919); --fd-ink2: var(--muted-foreground, #666); --fd-surface: var(--card, #fff);
  --fd-bd: var(--border, #e5e5e5); --fd-grid: color-mix(in srgb, var(--foreground, #191919) 9%, transparent);
  --fd-base: color-mix(in srgb, var(--foreground, #191919) 30%, transparent);
  --fd-mono: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}
html.dark #tab-fiidii-view { --fd-fii: #338ced; --fd-dii: #e76624; --fd-pro: #00a888; --fd-client: #d28e05; }
#tab-fiidii-view .fd { position: relative; display: flex; flex-direction: column; gap: 16px; color: var(--fd-ink); }
#tab-fiidii-view .up { color: var(--fd-up); }
#tab-fiidii-view .dn { color: var(--fd-dn); }

/* header */
#tab-fiidii-view .fd-head { position: relative; overflow: hidden; border: 1px solid var(--fd-bd); border-radius: 16px; background: linear-gradient(120deg, color-mix(in srgb, var(--fd-fii) 10%, var(--fd-surface)), var(--fd-surface) 55%, color-mix(in srgb, var(--fd-dii) 8%, var(--fd-surface))); padding: 20px 22px; }
#tab-fiidii-view .fd-aura { position: absolute; inset: auto 0 0 0; width: 100%; height: 100%; pointer-events: none; opacity: .5; }
#tab-fiidii-view .fd-wave { fill: none; stroke-width: 2; stroke-linecap: round; stroke-dasharray: 6 10; animation: fdFlow 14s linear infinite; }
#tab-fiidii-view .fd-wave.a { stroke: color-mix(in srgb, var(--fd-fii) 55%, transparent); }
#tab-fiidii-view .fd-wave.b { stroke: color-mix(in srgb, var(--fd-dii) 45%, transparent); animation-duration: 19s; animation-direction: reverse; }
@keyframes fdFlow { to { stroke-dashoffset: -320; } }
#tab-fiidii-view .fd-head-in { position: relative; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 14px; }
#tab-fiidii-view .fd-kicker { display: inline-flex; align-items: center; gap: 8px; font: 700 11px/1 var(--fd-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--fd-ink2); }
#tab-fiidii-view .fd-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--fd-pro); box-shadow: 0 0 0 0 color-mix(in srgb, var(--fd-pro) 60%, transparent); animation: fdPulse 2s infinite; }
@keyframes fdPulse { 70% { box-shadow: 0 0 0 8px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
#tab-fiidii-view .fd-title { margin: 8px 0 4px; font-size: clamp(18px, 2.2vw, 24px); font-weight: 800; letter-spacing: -.01em; }
#tab-fiidii-view .fd-sub { margin: 0; max-width: 62ch; font-size: 13px; color: var(--fd-ink2); }
#tab-fiidii-view .fd-head-r { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
#tab-fiidii-view .fd-asof { display: flex; flex-direction: column; gap: 2px; font-size: 11.5px; color: var(--fd-ink2); text-align: right; }
#tab-fiidii-view .fd-asof b { color: var(--fd-ink); font-weight: 700; }
#tab-fiidii-view .fd-btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 9px; border: 1px solid var(--fd-bd); background: var(--fd-surface); color: var(--fd-ink); font-size: 12px; font-weight: 600; cursor: pointer; transition: border-color .2s, transform .2s; }
#tab-fiidii-view .fd-btn:hover { border-color: var(--fd-fii); transform: translateY(-1px); }
#tab-fiidii-view .fd-btn.spin svg { animation: fdSpin .9s linear infinite; }
@keyframes fdSpin { to { transform: rotate(360deg); } }
#tab-fiidii-view .fd-warn { padding: 9px 12px; border-radius: 10px; border: 1px solid color-mix(in srgb, #fbb315 50%, var(--fd-bd)); background: color-mix(in srgb, #fbb315 10%, var(--fd-surface)); font-size: 12.5px; }

/* KPI strip */
#tab-fiidii-view .fd-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
#tab-fiidii-view .fd-kpi { position: relative; overflow: hidden; display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; border-radius: 14px; border: 1px solid var(--fd-bd); background: var(--fd-surface); min-width: 0; }
#tab-fiidii-view .fd-kpi::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--fd-base); }
#tab-fiidii-view .fd-kpi.up::before { background: var(--fd-up); }
#tab-fiidii-view .fd-kpi.dn::before { background: var(--fd-dn); }
#tab-fiidii-view .fd-kpi span { font-size: 11.5px; color: var(--fd-ink2); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#tab-fiidii-view .fd-kpi b { font: 800 22px/1.15 var(--fd-mono); letter-spacing: -.02em; color: var(--fd-ink); white-space: nowrap; }
#tab-fiidii-view .fd-kpi small { font-size: 11.5px; color: var(--fd-ink2); }
#tab-fiidii-view .fd-kpi.sk span, #tab-fiidii-view .fd-kpi.sk b, #tab-fiidii-view .fd-kpi.sk small { display: block; height: 10px; width: 60%; border-radius: 5px; background: var(--fd-grid); animation: fdShimmer 1.2s ease-in-out infinite alternate; }
#tab-fiidii-view .fd-kpi.sk b { height: 22px; width: 75%; }
@keyframes fdShimmer { to { opacity: .45; } }
#tab-fiidii-view .fd-kpi.enter { animation: fdRise .5s cubic-bezier(.2, .8, .2, 1) both; animation-delay: calc(var(--i) * 70ms); }
@keyframes fdRise { from { opacity: 0; transform: translateY(10px); } }

/* cards */
#tab-fiidii-view .fd-grid2 { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 16px; }
#tab-fiidii-view .fd-grid2.wide-l { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
#tab-fiidii-view .fd-card { border: 1px solid var(--fd-bd); border-radius: 16px; background: var(--fd-surface); padding: 16px 16px 12px; min-width: 0; animation: fdRise .55s cubic-bezier(.2, .8, .2, 1) both; animation-delay: calc(var(--i, 0) * 60ms); }
#tab-fiidii-view .fd-card-h { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 8px; }
#tab-fiidii-view .fd-card-h h2 { margin: 0; font-size: 15px; font-weight: 800; }
#tab-fiidii-view .fd-card-h p { margin: 3px 0 0; font-size: 12px; color: var(--fd-ink2); max-width: 70ch; }
#tab-fiidii-view .fd-ctl { display: flex; flex-wrap: wrap; gap: 8px; }
#tab-fiidii-view .fd-seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 10px; background: color-mix(in srgb, var(--fd-ink) 5%, transparent); border: 1px solid var(--fd-bd); }
#tab-fiidii-view .fd-seg button { padding: 4px 9px; border-radius: 7px; border: 0; background: transparent; color: var(--fd-ink2); font-size: 11.5px; font-weight: 600; cursor: pointer; white-space: nowrap; transition: background .2s, color .2s; }
#tab-fiidii-view .fd-seg button:hover { color: var(--fd-ink); }
#tab-fiidii-view .fd-seg button.on { background: var(--fd-surface); color: var(--fd-ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
#tab-fiidii-view .fd-seg button:focus-visible, #tab-fiidii-view .fd-lg:focus-visible, #tab-fiidii-view .fd-btn:focus-visible { outline: 2px solid var(--fd-fii); outline-offset: 1px; }
#tab-fiidii-view .fd-foot { display: flex; flex-wrap: wrap; gap: 6px 18px; padding-top: 8px; border-top: 1px dashed var(--fd-bd); font-size: 12px; color: var(--fd-ink2); }
#tab-fiidii-view .fd-foot b { color: var(--fd-ink); font-family: var(--fd-mono); }
#tab-fiidii-view .fd-foot b.up { color: var(--fd-up); } #tab-fiidii-view .fd-foot b.dn { color: var(--fd-dn); }
#tab-fiidii-view .fd-empty { padding: 40px 0; text-align: center; color: var(--fd-ink2); font-size: 13px; }

/* charts */
#tab-fiidii-view .fd-chart { position: relative; }
#tab-fiidii-view .fd-svg { display: block; width: 100%; height: auto; overflow: visible; }
#tab-fiidii-view .fd-grid { stroke: var(--fd-grid); stroke-width: 1; }
#tab-fiidii-view .fd-base { stroke: var(--fd-base); stroke-width: 1; }
#tab-fiidii-view .fd-mid { stroke: var(--fd-base); stroke-width: 1; stroke-dasharray: 3 4; }
#tab-fiidii-view .fd-ax { fill: var(--fd-ink2); font: 10.5px var(--fd-mono); }
#tab-fiidii-view .fd-bar path { stroke: var(--fd-surface); stroke-width: 1; transition: opacity .15s; }
#tab-fiidii-view .fd-bar.pos path { fill: var(--fd-up); }
#tab-fiidii-view .fd-bar.neg path { fill: var(--fd-dn); }
#tab-fiidii-view .fd-bar.part path { fill-opacity: .55; stroke-dasharray: 3 2; }
#tab-fiidii-view .fd-svg:hover .fd-bar path { opacity: .55; }
#tab-fiidii-view .fd-svg:hover .fd-bar.hl path { opacity: 1; }
#tab-fiidii-view .fd-svg.grow .fd-bar { animation: fdGrow .6s cubic-bezier(.2, .9, .3, 1.1) both; animation-delay: calc(var(--i) * 18ms); }
@keyframes fdGrow { from { transform: scaleY(0); } }
#tab-fiidii-view .fd-hit { fill: transparent; cursor: crosshair; }
#tab-fiidii-view .fd-line { fill: none; stroke: var(--c); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
#tab-fiidii-view .fd-svg.draw .fd-line { stroke-dasharray: 100; animation: fdDraw 1.1s ease-out both; }
@keyframes fdDraw { from { stroke-dashoffset: 100; } to { stroke-dashoffset: 0; } }
#tab-fiidii-view .fd-end { fill: var(--c); stroke: var(--fd-surface); stroke-width: 2; }
#tab-fiidii-view .fd-svg.draw .fd-end, #tab-fiidii-view .fd-svg.draw .fd-endlbl { animation: fdFade .4s 1s both; }
@keyframes fdFade { from { opacity: 0; } }
#tab-fiidii-view .fd-endlbl { fill: var(--fd-ink); font: 700 11px var(--fd-mono); }
#tab-fiidii-view .fd-xline { stroke: var(--fd-base); stroke-width: 1; stroke-dasharray: 3 3; }
#tab-fiidii-view .fd-cross circle { fill: var(--c); stroke: var(--fd-surface); stroke-width: 2; }
#tab-fiidii-view .fd-legend { display: flex; flex-wrap: wrap; gap: 8px; margin: 2px 0 6px; }
#tab-fiidii-view .fd-lg { display: inline-flex; align-items: center; gap: 7px; padding: 5px 10px; border-radius: 999px; border: 1px solid var(--fd-bd); background: transparent; color: var(--fd-ink2); font-size: 12px; font-weight: 700; cursor: pointer; transition: border-color .2s, background .2s, color .2s; }
#tab-fiidii-view .fd-lg i { width: 10px; height: 10px; border-radius: 3px; background: var(--c); opacity: .35; transition: opacity .2s; }
#tab-fiidii-view .fd-lg b { font: 600 11.5px var(--fd-mono); color: var(--fd-ink2); }
#tab-fiidii-view .fd-lg.on { color: var(--fd-ink); border-color: color-mix(in srgb, var(--c) 60%, var(--fd-bd)); background: color-mix(in srgb, var(--c) 8%, transparent); }
#tab-fiidii-view .fd-lg.on i { opacity: 1; }
#tab-fiidii-view .fd-lg.on b { color: var(--fd-ink); }
#tab-fiidii-view .fd-sw { display: inline-block; width: 9px; height: 9px; border-radius: 3px; background: var(--c); margin-right: 6px; vertical-align: 0; }

/* tooltip */
#tab-fiidii-view .fd-tip { position: absolute; left: 0; top: 0; z-index: 20; min-width: 180px; max-width: 280px; padding: 9px 11px; border-radius: 10px; border: 1px solid var(--fd-bd); background: var(--fd-surface); box-shadow: 0 10px 28px -12px rgba(0, 0, 0, .45); font-size: 12px; pointer-events: none; }
#tab-fiidii-view .fd-tip > b { display: block; margin-bottom: 5px; font-size: 12px; }
#tab-fiidii-view .fd-tip-row { display: flex; justify-content: space-between; gap: 14px; padding: 1.5px 0; color: var(--fd-ink2); }
#tab-fiidii-view .fd-tip-row b { color: var(--fd-ink); font-family: var(--fd-mono); font-weight: 600; white-space: nowrap; }
#tab-fiidii-view .fd-tip-row b.up { color: var(--fd-up); } #tab-fiidii-view .fd-tip-row b.dn { color: var(--fd-dn); }
#tab-fiidii-view .fd-tip-row em { font-style: normal; color: var(--fd-ink2); font-weight: 400; }

/* tables */
#tab-fiidii-view .fd-tablewrap { overflow-x: auto; }
#tab-fiidii-view .fd-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
#tab-fiidii-view .fd-table th, #tab-fiidii-view .fd-table td { padding: 8px 10px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--fd-bd); }
#tab-fiidii-view .fd-table thead th { font-size: 11px; font-weight: 700; color: var(--fd-ink2); text-transform: uppercase; letter-spacing: .04em; position: sticky; top: 0; background: var(--fd-surface); }
#tab-fiidii-view .fd-table th:first-child { text-align: left; }
#tab-fiidii-view .fd-table tbody th { font-weight: 700; }
#tab-fiidii-view .fd-table td { font-family: var(--fd-mono); }
#tab-fiidii-view .fd-table td small { display: block; font-size: 10.5px; color: var(--fd-ink2); }
#tab-fiidii-view .fd-table td small.up { color: var(--fd-up); } #tab-fiidii-view .fd-table td small.dn { color: var(--fd-dn); }
#tab-fiidii-view .fd-table tbody tr { animation: fdRise .4s ease both; animation-delay: calc(var(--i, 0) * 40ms); transition: background .15s; }
#tab-fiidii-view .fd-table tbody tr:hover { background: color-mix(in srgb, var(--fd-ink) 4%, transparent); }
#tab-fiidii-view .fd-mute { color: var(--fd-ink2); }

/* gauge */
#tab-fiidii-view .fd-gauge { display: flex; flex-direction: column; gap: 10px; padding-top: 4px; }
#tab-fiidii-view .fd-gauge-top { display: flex; align-items: baseline; gap: 12px; }
#tab-fiidii-view .fd-gauge-top b { font: 800 34px/1 var(--fd-mono); letter-spacing: -.03em; }
#tab-fiidii-view .fd-stance { padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; border: 1px solid currentColor; }
#tab-fiidii-view .fd-meter { position: relative; height: 16px; border-radius: 8px; overflow: visible; margin-top: 8px; }
#tab-fiidii-view .fd-meter .z { position: absolute; top: 0; bottom: 0; }
#tab-fiidii-view .fd-meter .z0 { background: color-mix(in srgb, var(--fd-dn) 55%, var(--fd-surface)); border-radius: 8px 0 0 8px; }
#tab-fiidii-view .fd-meter .z1 { background: color-mix(in srgb, var(--fd-dn) 25%, var(--fd-surface)); }
#tab-fiidii-view .fd-meter .z2 { background: color-mix(in srgb, var(--fd-ink) 10%, var(--fd-surface)); }
#tab-fiidii-view .fd-meter .z3 { background: color-mix(in srgb, var(--fd-up) 25%, var(--fd-surface)); }
#tab-fiidii-view .fd-meter .z4 { background: color-mix(in srgb, var(--fd-up) 55%, var(--fd-surface)); border-radius: 0 8px 8px 0; }
#tab-fiidii-view .fd-meter .z + .z { box-shadow: inset 2px 0 0 var(--fd-surface); }
#tab-fiidii-view .fd-range { position: absolute; top: -5px; height: 4px; border-radius: 2px; background: var(--fd-fii); opacity: .8; }
#tab-fiidii-view .fd-needle { position: absolute; top: -7px; bottom: -7px; width: 4px; margin-left: -2px; border-radius: 2px; background: var(--fd-ink); box-shadow: 0 0 0 2px var(--fd-surface); left: 50%; transition: left 1s cubic-bezier(.2, .9, .3, 1.15); }
#tab-fiidii-view .fd-meter.in .fd-needle { left: var(--x); }
#tab-fiidii-view .fd-meter-ax { position: relative; height: 14px; font: 10.5px var(--fd-mono); color: var(--fd-ink2); }
#tab-fiidii-view .fd-meter-ax span { position: absolute; transform: translateX(-50%); }
#tab-fiidii-view .fd-meter-ax span:nth-child(1) { left: 0; transform: none; }
#tab-fiidii-view .fd-meter-ax span:nth-child(2) { left: 30%; }
#tab-fiidii-view .fd-meter-ax span:nth-child(3) { left: 45%; }
#tab-fiidii-view .fd-meter-ax span:nth-child(4) { left: 55%; }
#tab-fiidii-view .fd-meter-ax span:nth-child(5) { left: 70%; }
#tab-fiidii-view .fd-meter-ax span:nth-child(6) { right: 0; transform: none; }
#tab-fiidii-view .fd-gstats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 4px 0 0; }
#tab-fiidii-view .fd-gstats div { padding: 8px 10px; border-radius: 10px; background: color-mix(in srgb, var(--fd-ink) 4%, transparent); }
#tab-fiidii-view .fd-gstats dt { font-size: 11px; color: var(--fd-ink2); }
#tab-fiidii-view .fd-gstats dd { margin: 2px 0 0; font: 700 13px var(--fd-mono); }
#tab-fiidii-view .fd-gstats small { color: var(--fd-ink2); font-weight: 400; }
#tab-fiidii-view .fd-read { margin: 2px 0 0; font-size: 12px; color: var(--fd-ink2); }
#tab-fiidii-view .fd-src { margin: 0; font-size: 11.5px; color: var(--fd-ink2); }

@media (max-width: 1100px) { #tab-fiidii-view .fd-grid2, #tab-fiidii-view .fd-grid2.wide-l { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 760px) { #tab-fiidii-view .fd-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } #tab-fiidii-view .fd-gstats { grid-template-columns: 1fr; } #tab-fiidii-view .fd-asof { text-align: left; } }
@media (prefers-reduced-motion: reduce) {
  #tab-fiidii-view *, #tab-fiidii-view *::before { animation: none !important; transition: none !important; }
}
