/* QFI Terminal — RATINGS module (Alt+4 » RESEARCH » RATINGS)
   Ported from terminal/assets/css/components.css:
     - "RSX DESIGN SYSTEM" block (~line 44140) for .card/.tag/.pt-stats/.rat-tbl base rules
     - ".rsx.rsx-flat" block (~line 65204) for the flat (borderless, amber-titled) skin
       the RATINGS sub-tab actually renders with (root class in ResearchComponent.js
       renderRatings() is `class="rsx rat-rsx rsx-flat"`)
     - "U. RATINGS FITTINGS" block (~line 74321) for the tab-specific overrides
       (opaque sticky table head, amber RATING CHANGE values, blue Maintain pill)
   All selectors scoped under .qm-ratings. No global resets. */

.qm-ratings {
    --rx-txt: #e2e6ec;
    --rx-mut: #808c9b;      /* lifted tone: rsx-flat sets --rx-mut/2 one step whiter
                                than the card-calibrated default, for a page with no
                                card behind the text */
    --rx-mut2: #aab4c1;
    --rx-blue: #4a90e2;
    --rx-green: #2ebd59;
    --rx-red: #e05252;
    --rx-big: #5b9bd9;
    --flat-h: #e88a2d;       /* SUMMARY's section-title amber */
    --flat-fill: rgba(255, 255, 255, 0.05);
    --flat-hair: rgba(255, 255, 255, 0.075);
    --rx-card: #000000;      /* --rx-card = var(--bg-primary) under rsx-flat: the
                                 card surface IS the page */
    font-family: 'Lato', 'Segoe UI', system-ui, -apple-system, Arial, sans-serif;
    color: var(--rx-txt);
    font-size: 15px;
    line-height: 1.5;
    box-sizing: border-box;
    width: 100%;
    height: 100%;
}
.qm-ratings * { box-sizing: border-box; }
.qm-ratings .mut { color: var(--rx-mut); }
.qm-ratings .sm { font-size: 12.5px; }

/* ---------------------------------------------------------------------- *
 * ratings.target — PRICE TARGETS card (E20)
 * ---------------------------------------------------------------------- */
.rs-stage[data-el="ratings.target"] { background: transparent; box-shadow: none; border-radius: 0; }
.qm-rat-target { padding: 4px 2px; }
.qm-rat-target .rat-part {
    opacity: 0;
    transform: translateY(10px);
    transition: opacity .48s ease, transform .58s cubic-bezier(.2,.65,.25,1);
}
.qm-rat-target .rat-part.go { opacity: 1; transform: none; }
.qm-rat-target .banner {
    background: none;
    border-radius: 0;
    font-size: 15.5px;
    font-weight: 800;
    padding: 0;
    margin-bottom: 14px;
}
.qm-rat-target .rat-sentence {
    font-size: 15px;
    color: var(--rx-mut2);
    margin: 0 0 16px;
}
.qm-rat-target .rat-sentence b { color: var(--rx-txt); }

.qm-rat-target .pt-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
    margin: 0 0 14px;
}
.qm-rat-target .pt-s .h { font-size: 14px; font-weight: 800; color: var(--rx-txt); }
.qm-rat-target .pt-s .v { font-size: 30px; font-weight: 900; color: var(--rx-big); white-space: nowrap; }
.qm-rat-target .pt-s .v small { font-size: 15px; font-weight: 700; color: var(--rx-mut); margin-left: 3px; }
.qm-rat-target .pt-s .d { font-size: 12.5px; font-weight: 800; margin-top: 2px; }

.qm-rat-target .chart-host { min-height: 160px; width: 100%; }
.qm-rat-target .chart-host svg { width: 100%; display: block; overflow: visible; }

/* entrance/idle drawing classes — ported verbatim from `.rsx svg .agr/.adr/.afd`
   (components.css ~44613-44623), gated by a `.go` class on the svg itself */
.qm-rat-target svg .afd { opacity: 0; transition: opacity 0.55s ease var(--d, 0ms); }
.qm-rat-target svg.go .afd { opacity: 1; }
.qm-rat-target svg .adr {
    stroke-dashoffset: 1;
    transition: stroke-dashoffset var(--dur, 1000ms) cubic-bezier(0.45, 0.1, 0.35, 0.95) var(--d, 0ms);
}
.qm-rat-target svg.go .adr { stroke-dashoffset: 0; }

/* ---------------------------------------------------------------------- *
 * ratings.changes — RECENT RATING CHANGES table (E21)
 * ---------------------------------------------------------------------- */
.rs-stage[data-el="ratings.changes"] { background: transparent; box-shadow: none; border-radius: 0; }
.qm-rat-changes { padding: 4px 2px; display: flex; flex-direction: column; height: 100%; }
.qm-rat-changes .rat-change-part {
    opacity: 0;
    transform: translateY(10px);
    transition: opacity .45s ease, transform .55s cubic-bezier(.2,.65,.25,1);
}
.qm-rat-changes .rat-change-part.go { opacity: 1; transform: none; }
.qm-rat-changes .rat-cardrow {
    display: flex;
    align-items: flex-start;
    justify-content: flex-end;
    gap: 10px;
    margin: 0 0 16px;
}
/* card h3 under rsx-flat: uppercase amber, letter-spaced (components.css ~65295) */
.qm-rat-changes h3 {
    font-size: 14.5px;
    font-weight: 800;
    letter-spacing: 0.9px;
    text-transform: uppercase;
    color: var(--flat-h);
    margin: 0;
}
.qm-rat-changes .tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: none;
    border-radius: 0;
    font-size: 14px;
    font-weight: 700;
    color: var(--rx-mut2);
    padding: 0;
    white-space: nowrap;
}
.qm-rat-changes .tag b { color: var(--rx-txt); }
.qm-rat-changes .tag i { font-style: normal; font-weight: 800; margin-left: 6px; }
.qm-rat-changes .tag i.up { color: #6fd693; }
.qm-rat-changes .tag i.dn { color: #ec8c8c; }
.qm-rat-changes .tag i.mt { color: var(--rx-mut); font-weight: 700; }

.qm-rat-changes .rat-chg-scroll {
    overflow: hidden;
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
}
.qm-rat-changes .rat-chg-scroll::-webkit-scrollbar { width: 8px; }
.qm-rat-changes .rat-chg-scroll::-webkit-scrollbar-thumb { background: #333; border-radius: 5px; }
.qm-rat-changes .rat-chg-scroll::-webkit-scrollbar-track { background: transparent; }

.qm-rat-changes .rat-tbl { width: 100%; height: 100%; border-collapse: collapse; font-size: 16.5px; }
.qm-rat-changes .rat-tbl th {
    padding: 7px 9px;
    text-align: left;
    font-size: 14.5px;
    font-weight: 800;
    letter-spacing: 0.5px;
    color: var(--rx-mut2);
    /* opaque lid over a scrolling body (U. RATINGS FITTINGS #3) */
    background: linear-gradient(var(--flat-fill), var(--flat-fill)), var(--rx-card);
    box-shadow: inset 0 -1px 0 var(--flat-hair);
    white-space: nowrap;
    position: sticky;
    top: 0;
}
.qm-rat-changes .rat-tbl th.act,
.qm-rat-changes .rat-tbl td.act { text-align: center; }
.qm-rat-changes .rat-tbl td {
    padding: 6px 9px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--rx-mut2);
    white-space: nowrap;
}
.qm-rat-changes .rat-tbl td.num { font-family: 'JetBrains Mono', 'Consolas', monospace; font-size: 15px; }
.qm-rat-changes .rat-tbl td.firm { color: var(--rx-txt); font-size: 16px; font-weight: 700; max-width: 280px; overflow: hidden; text-overflow: ellipsis; }
/* rating change value takes the tab's heading amber, on ONE token per row (U.
   RATINGS FITTINGS, the amber note): the whole cell is not tinted, only <b> */
.qm-rat-changes .rat-tbl td.chg { font-family: 'JetBrains Mono', 'Consolas', monospace; font-size: 16px; font-weight: 700; }
.qm-rat-changes .rat-tbl td.chg .rating-tone { font-weight: 800; }
.qm-rat-changes .rat-tbl td.chg .tone-bull { color: #20c875; }
.qm-rat-changes .rat-tbl td.chg .tone-neutral { color: #e6b422; }
.qm-rat-changes .rat-tbl td.chg .tone-bear { color: #ff4655; }
.qm-rat-changes .rat-tbl td.chg .rating-arrow { color: #e7edf5; margin: 0 8px; }
.qm-rat-changes .rat-tbl tbody tr:hover td { background: rgba(255, 255, 255, 0.05); }

.qm-rat-changes .rat-act {
    display: inline-block;
    font-size: 14.5px;
    font-weight: 800;
    letter-spacing: 0.3px;
    border-radius: 0;
    padding: 0;
}
.qm-rat-changes .rat-act.up { background: none; color: #20c875; }
.qm-rat-changes .rat-act.dn { background: none; color: #ff4655; }
.qm-rat-changes .rat-act.mt { background: none; color: #e6b422; }
/* row cascade-in (enter + idle replay) */
.qm-rat-changes .rat-tbl tbody tr {
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 0.5s ease var(--rd, 0ms), transform 0.5s cubic-bezier(0.2, 0.65, 0.25, 1) var(--rd, 0ms);
}
.qm-rat-changes .rat-tbl.go tbody tr { opacity: 1; transform: none; }

/* shared satellite tooltip (ported from .rsx-tip, components.css ~44839),
   appended to <body> like the terminal's own — namespaced, never nested
   under .qm-ratings in the DOM, so it is scoped by name here instead */
.qm-ratings-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, 0.5);
}
.qm-ratings-tip .t-h { font-weight: 800; margin-bottom: 2px; }

/* ---------------------------------------------------------------------- *
 * ratings.stage — eq-analysts. Canvas is a fixed 1520x590 design box
 * (module.size), so every number below is a literal px position inside
 * it: step 0 = ratings.changes centred and ~15% larger than rest; step 1
 * = it settles into a right-hand slot at its normal scale while
 * ratings.target slides/fades in from the left, at the same scale so the
 * two read as one balanced, symmetric pair either side of the middle.
 * ---------------------------------------------------------------------- */
.qm-rat-stage { position: relative; width: 1520px; height: 590px; overflow: hidden; background: #000; }
.qm-rat-stage .rst-slot {
    position: absolute; left: 0; top: 0; transform-origin: 0 0;
    transition: transform 0.95s var(--out, cubic-bezier(0.16, 1, 0.3, 1)), opacity 0.6s var(--out, cubic-bezier(0.16, 1, 0.3, 1));
}
/* step 0: the changes table alone, centred and larger */
.qm-rat-stage .rst-changes {
    width: 760px; height: 520px; z-index: 2;
    opacity: 1; transform: translate(357.2px, 19.4px) scale(1.06);
}
/* step 0: the target panel waits off to the left, invisible and inert */
.qm-rat-stage .rst-target {
    width: 760px; height: 470px; z-index: 1;
    opacity: 0; pointer-events: none; transform: translate(-20px, 78.6px) scale(0.9211);
}
/* step 1: table glides right and settles at its resting scale; target
   fades/slides into its mirrored left-hand slot at the same scale */
.qm-rat-stage .rst-changes.rst-step1 { transform: translate(780px, 55.5px) scale(0.9211); }
.qm-rat-stage .rst-target.rst-step1 { opacity: 1; pointer-events: auto; transform: translate(40px, 78.6px) scale(0.9211); }
@media (prefers-reduced-motion: reduce) { .qm-rat-stage .rst-slot { transition: opacity 0.3s linear; } }
