/* QFI Terminal -- OWNERSHIP module
   Ported from terminal/assets/css/components.css:
     - RSX DESIGN SYSTEM base (~44140) -- cards, subheads, tags, badges
     - own-* rules (~44650-44730) -- distribution bar, legend, tables, dvg rows, stats
     - "flat" skin (~65190-65340) -- no boxes, amber uppercase headers, hairline separators
     - "THE DETAIL PASS" (~80744-80920) -- gradients/glow on bars, rows, badges
   All selectors scoped under .qm-ownership. Background is transparent (stage supplies black). */

.qm-ownership {
    --flat-h: #e88a2d;
    --flat-fill: rgba(255, 255, 255, 0.05);
    --flat-hair: rgba(255, 255, 255, 0.075);
    --rx-line: #333333;
    --rx-txt: #e2e6ec;
    --rx-mut: #808c9b;
    --rx-mut2: #aab4c1;
    --rx-red: #e05252;
    --rx-green: #2ebd59;
    font-family: 'Lato', 'Segoe UI', system-ui, -apple-system, Arial, sans-serif;
    color: var(--rx-txt);
    font-size: 15px;
    line-height: 1.5;
    background: transparent;
    -webkit-font-smoothing: antialiased;
}
.qm-ownership .mono { font-family: 'JetBrains Mono', 'Consolas', monospace; }
.qm-ownership .neg { color: var(--rx-red) !important; }
.qm-ownership .pos { color: var(--rx-green) !important; }
.qm-ownership .hr { border-top: 1px solid var(--rx-line); margin: 16px 0; }

/* section label + card head, uppercase amber (flat skin) */
.qm-ownership .rsx-subhead { display: flex; gap: 10px; align-items: baseline; margin: 0 0 14px; }
.qm-ownership .rsx-subhead:not(:first-child) { margin-top: 26px; padding-top: 20px; box-shadow: inset 0 1px 0 var(--flat-hair); }
.qm-ownership .rsx-subhead h3,
.qm-ownership .card h3 {
    font-size: 14.5px;
    font-weight: 800;
    letter-spacing: 0.9px;
    text-transform: uppercase;
    color: var(--flat-h);
    margin: 0;
}
.qm-ownership .card { padding: 0; }
.qm-ownership .card + .card { margin-top: 22px; padding-top: 20px; box-shadow: inset 0 1px 0 var(--flat-hair); }
.qm-ownership .rsx-cardrow { display: flex; align-items: flex-start; gap: 10px; justify-content: space-between; margin: 0 0 16px; }

.rs-stage[data-el="ownership.breakdown"] { --rs-min-k: .54; background: transparent; box-shadow: none; border-radius: 0; }
.qm-own-breakdown .card + .card { margin-top: 17px; padding-top: 0; box-shadow: none; }
.qm-own-breakdown .card h3 { font-size: 22px; }
.qm-own-breakdown .tag { font-size: 15.5px; }

/* pills */
.qm-ownership .tag { display: inline-flex; align-items: center; gap: 6px; background: var(--flat-fill); border-radius: 3px; font-size: 12px; font-weight: 700; color: var(--rx-mut2); padding: 4px 10px; white-space: nowrap; }
.qm-ownership .tag b { color: var(--rx-txt); }
.qm-ownership .own-asof { margin-left: 8px; font-weight: 600; color: var(--rx-mut); letter-spacing: 0.5px; }

/* entrance animation primitives (ported from .arev/.afade/.hb/.arm) */
.qm-ownership .arev { opacity: 0; transform: translateY(14px); transition: opacity .6s ease var(--d,0ms), transform .6s cubic-bezier(.2,.65,.25,1) var(--d,0ms); }
.qm-ownership .arev.go { opacity: 1; transform: none; }
.qm-ownership .afade { opacity: 0; transition: opacity .55s ease var(--d,0ms); }
.qm-ownership .afade.go { opacity: 1; }
.qm-ownership .hb { width: 0 !important; transition: width .85s cubic-bezier(.25,.7,.3,1) var(--d,0ms); }
.qm-ownership .arm .hb { width: 0 !important; }
.qm-ownership .arm.go .hb { width: var(--w) !important; }

/* ---------------------------------------------------------------------------
   Ownership Breakdown -- distribution bar + legend
   --------------------------------------------------------------------------- */
.qm-ownership .own-bar {
    display: flex; height: 34px; border-radius: 4px; overflow: hidden;
    background: var(--flat-fill);
    box-shadow: inset 0 1px 2px rgba(0,0,0,.55), inset 0 0 0 1px rgba(255,255,255,.04);
}
.qm-own-breakdown .own-bar {
    clip-path: inset(0 100% 0 0);
    transition: clip-path .9s cubic-bezier(.25,.7,.3,1);
}
.qm-own-breakdown .own-bar.is-resetting { clip-path: inset(0 100% 0 0) !important; transition: none !important; }
.qm-own-breakdown .own-bar.go { clip-path: inset(0); }
.qm-ownership .own-seg {
    min-width: 3px; height: 100%;
    --seam: 0 0 0 0 transparent;
    box-shadow: var(--seam), inset 0 14px 13px -13px rgba(255,255,255,.40), inset 0 -13px 13px -12px rgba(0,0,0,.46);
    transition: filter .15s ease;
}
.qm-ownership .own-seg:not(:last-child) { --seam: inset -1px 0 0 rgba(0,0,0,.55); }
.qm-ownership .own-seg:hover { filter: brightness(1.15); cursor: default; }

.qm-ownership .own-leg { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px 18px; margin-top: 16px; }
.qm-ownership .own-leg .it { display: flex; align-items: center; gap: 9px; min-width: 0; }
.qm-ownership .own-leg .ln { width: 16px; height: 3px; border-radius: 2px; flex: none; box-shadow: 0 0 7px -1px currentColor; }
.qm-ownership .own-leg .lb { font-size: 12.5px; color: var(--rx-mut2); white-space: nowrap; }
.qm-ownership .own-leg .sh { font-family: 'JetBrains Mono', 'Consolas', monospace; font-size: 11.5px; color: var(--rx-mut); white-space: nowrap; }
.qm-ownership .own-leg .v { font-family: 'JetBrains Mono', 'Consolas', monospace; font-size: 13px; font-weight: 700; color: var(--rx-txt); white-space: nowrap; }
.qm-own-breakdown .own-leg { margin-top: 17px; }
.qm-own-breakdown .own-leg .lb { font-size: 18px; }
.qm-own-breakdown .own-leg .sh { font-size: 15.5px; }
.qm-own-breakdown .own-leg .v { font-size: 18px; }

/* ---------------------------------------------------------------------------
   Top 25 Shareholders table
   --------------------------------------------------------------------------- */
.qm-ownership .own-scroll { overflow-x: auto; overflow-y: auto; scrollbar-width: thin; scrollbar-color: rgba(151,162,176,.3) transparent; }
.qm-ownership .own-scroll::-webkit-scrollbar { width: 8px; height: 8px; }
.qm-ownership .own-scroll::-webkit-scrollbar-track { background: transparent; }
.qm-ownership .own-scroll::-webkit-scrollbar-thumb { background: rgba(151,162,176,.28); border-radius: 8px; }
.qm-ownership .own-tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.qm-ownership .own-tbl thead th {
    position: sticky; top: 0; z-index: 1;
    padding: 7px 9px; text-align: left; font-size: 11.5px; font-weight: 800; letter-spacing: .5px;
    color: var(--rx-mut2); background: #060606; white-space: nowrap;
}
.qm-ownership .own-tbl th.r, .qm-ownership .own-tbl td.r { text-align: right; }
.qm-ownership .own-tbl td { padding: 6px 9px; border-top: 1px solid rgba(255,255,255,.05); color: var(--rx-mut2); white-space: nowrap; }
.qm-ownership .own-tbl td.num { font-family: 'JetBrains Mono', 'Consolas', monospace; font-size: 12px; }
.qm-ownership .own-tbl td.hold { color: var(--rx-txt); font-weight: 700; max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.qm-own-breakdown .own-tbl { font-size: 18px; }
.qm-own-breakdown .own-tbl thead th { font-size: 15.5px; padding-top: 8px; padding-bottom: 8px; }
.qm-own-breakdown .own-tbl td { padding-top: 8px; padding-bottom: 8px; }
.qm-own-breakdown .own-tbl td.num { font-size: 16px; }
.qm-ownership .own-tbl tbody tr {
    background: linear-gradient(90deg,
        rgba(168,85,247,.17) 0%,
        rgba(168,85,247,.12) calc(var(--w,0%) * .55),
        rgba(168,85,247,.02) calc(var(--w,0%) * .93),
        transparent var(--w,0%));
    transition: background-color .5s ease;
}
.qm-ownership .own-tbl tbody tr.qm-ghost td { background-color: rgba(255,255,255,.07); }
.qm-ownership .own-tbl tbody tr.qm-ghost td:first-child { box-shadow: inset 2px 0 0 var(--flat-h); }
.qm-ownership .own-tbl tbody tr.qm-rowin { opacity: 0; transform: translateX(-10px); transition: opacity .42s ease, transform .52s cubic-bezier(.16,1,.3,1); }
.qm-ownership .own-tbl tbody tr.qm-rowin.go { opacity: 1; transform: none; }

/* ---------------------------------------------------------------------------
   Insider Trading Volume -- diverging bars
   --------------------------------------------------------------------------- */
.qm-ownership .own-period { font-family: 'JetBrains Mono', 'Consolas', monospace; font-size: 11px; letter-spacing: .5px; color: var(--rx-mut); white-space: nowrap; align-self: center; }
.qm-ownership .own-volstack { display: flex; flex-direction: column; gap: 16px; }
.qm-ownership .own-volstack .hr { margin: 0; }
.qm-ownership .dvg { display: flex; flex-direction: column; gap: 13px; }
.qm-ownership .dvg .main { display: flex; align-items: center; height: 26px; }
.qm-ownership .dvg .q { width: 66px; flex: none; font-family: 'JetBrains Mono', 'Consolas', monospace; font-size: 11px; font-weight: 700; color: var(--rx-mut2); }
.qm-ownership .dvg .side { flex: 1; min-width: 0; display: flex; align-items: center; gap: 7px; height: 100%; }
.qm-ownership .dvg .side.l { justify-content: flex-end; }
.qm-ownership .dvg .axis { width: 1px; align-self: stretch; background: linear-gradient(to bottom, transparent, rgba(255,255,255,.26) 22%, rgba(255,255,255,.26) 78%, transparent); flex: none; }
.qm-ownership .dvg .bar { height: 16px; }
.qm-ownership .dvg .bar.sell {
    border-radius: 3px 0 0 3px;
    background: linear-gradient(to left, rgba(224,82,82,.26) 0%, rgba(224,82,82,.86) calc(100% - 3px), #f98d8d calc(100% - 3px));
    box-shadow: 0 0 12px -3px rgba(224,82,82,.50), inset 0 1px 0 rgba(255,255,255,.10);
}
.qm-ownership .dvg .bar.buy {
    border-radius: 0 3px 3px 0;
    background: linear-gradient(to right, rgba(46,189,89,.26) 0%, rgba(46,189,89,.86) calc(100% - 3px), #5ee08a calc(100% - 3px));
    box-shadow: 0 0 12px -3px rgba(46,189,89,.50), inset 0 1px 0 rgba(255,255,255,.10);
}
.qm-ownership .dvg .val { font-family: 'JetBrains Mono', 'Consolas', monospace; font-size: 11.5px; white-space: nowrap; }
.qm-ownership .dvg .meta { display: flex; justify-content: space-between; gap: 10px; padding-left: 66px; margin-top: 2px; font-family: 'JetBrains Mono', 'Consolas', monospace; font-size: 11.5px; color: var(--rx-mut); }
.qm-ownership .qrow { border-radius: 5px; transition: background-color .4s ease; }
.qm-ownership .qrow.qm-ghost { background-color: rgba(255,255,255,.05); }

/* PERIOD SUMMARY */
.qm-ownership .own-lbl { font-size: 11.5px; font-weight: 800; letter-spacing: .8px; color: var(--rx-mut2); margin-bottom: 12px; }
.qm-ownership .own-stats { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 0; }
.qm-ownership .own-stat { padding: 0 18px; box-shadow: inset 1px 0 0 var(--flat-hair); }
.qm-ownership .own-stat:first-child { padding-left: 0; box-shadow: none; }
.qm-ownership .own-stat:last-child { padding-right: 0; }
.qm-ownership .own-stat .k { font-size: 11.5px; font-weight: 800; letter-spacing: .8px; color: var(--rx-mut); }
.qm-ownership .own-stat .v { font-family: 'JetBrains Mono', 'Consolas', monospace; font-size: 15px; font-weight: 800; margin-top: 4px; color: var(--rx-txt); }
.qm-ownership .own-stat .s { font-family: 'JetBrains Mono', 'Consolas', monospace; font-size: 11.5px; color: var(--rx-mut); margin-top: 1px; }
.qm-ownership .ov-badge {
    font-family: 'Lato', 'Segoe UI', system-ui, sans-serif;
    font-size: 12px; font-weight: 800; padding: 4px 10px; border-radius: 4px; display: inline-block; color: #fff;
    background: linear-gradient(180deg, #ea6a6a, #b93f3f);
    box-shadow: 0 0 16px -5px rgba(224,82,82,.75), inset 0 1px 0 rgba(255,255,255,.22);
}
.qm-ownership .ov-badge.un { background: linear-gradient(180deg, #35b862, #1a7b3c); box-shadow: 0 0 16px -5px rgba(46,189,89,.75), inset 0 1px 0 rgba(255,255,255,.22); }
.qm-ownership .ov-badge.nrv { background: var(--flat-fill); color: var(--rx-mut2); box-shadow: inset 0 1px 0 rgba(255,255,255,.10); }
.qm-ownership .ov-badge.pulse { animation: qm-own-pulse 1.1s ease-out; }
@keyframes qm-own-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(224,82,82,.55), inset 0 1px 0 rgba(255,255,255,.22); }
    60%  { box-shadow: 0 0 0 10px rgba(224,82,82,0), inset 0 1px 0 rgba(255,255,255,.22); }
    100% { box-shadow: 0 0 16px -5px rgba(224,82,82,.75), inset 0 1px 0 rgba(255,255,255,.22); }
}
.qm-ownership .ov-badge.un.pulse { animation-name: qm-own-pulse-g; }
@keyframes qm-own-pulse-g {
    0%   { box-shadow: 0 0 0 0 rgba(46,189,89,.55), inset 0 1px 0 rgba(255,255,255,.22); }
    60%  { box-shadow: 0 0 0 10px rgba(46,189,89,0), inset 0 1px 0 rgba(255,255,255,.22); }
    100% { box-shadow: 0 0 16px -5px rgba(46,189,89,.75), inset 0 1px 0 rgba(255,255,255,.22); }
}

/* ---------------------------------------------------------------------------
   ownership.stage -- step 0 (breakdown centred, larger) glides to step 1
   (breakdown left half, insiders fades/slides in on the right). See module.js.
   --------------------------------------------------------------------------- */
.qm-ownership-stage { position: relative; width: 100%; height: 100%; }
.qm-ownership-stage .ownstg-a,
.qm-ownership-stage .ownstg-b {
    position: absolute; top: 0; left: 0; transform-origin: top left;
    transition: transform 900ms cubic-bezier(.22,.68,.22,1), opacity 650ms ease;
    will-change: transform, opacity;
}
.qm-ownership-stage .ownstg-b { opacity: 0; pointer-events: none; }

/* tooltip (ported from .rsx-tip) */
.qm-own-tip {
    position: fixed; z-index: 9999;
    background: #10151c; border: 1px solid #2d3644; color: #e8edf3;
    font-family: 'Lato', 'Segoe UI', system-ui, sans-serif; font-size: 12px;
    padding: 7px 10px; border-radius: 8px; pointer-events: none; display: none;
    max-width: 290px; line-height: 1.45; box-shadow: 0 4px 14px rgba(0,0,0,.5);
}
.qm-own-tip .t-h { font-weight: 800; margin-bottom: 2px; }
