/* Company-card pinned compact bar.

   GLOBAL (not component-scoped) on purpose so the rule still attaches if
   the markup ever gets relocated by a layout component / section outlet.

   It is a full-width strip pinned just under the 52px tab bar, shown only
   once the hero scrolls out of view. Authored inline at the top of
   CompanyProfileV2.razor as the first child of <main class="ps-app-content">
   (a plain block container — no flex-column parent quirks), so position:
   sticky;top:52px pins it directly below the sticky TabBar across the
   whole page scroll.

   IMPORTANT — position:STICKY, not fixed. A position:fixed bar here failed
   to paint its (opaque) background on some GPUs/drivers: a known Chromium
   compositing bug where the always-promoted fixed layer renders without
   its background, so page content shows straight through. The sibling
   TabBar uses position:sticky and never exhibits this. Sticky stays in
   the normal paint flow of the scrolling page, is never promoted to that
   broken fixed layer, and paints opaque everywhere.

   Hidden via display:none (not visibility:hidden) so it reserves no space
   in flow while hidden; revealed above the current scroll position, scroll
   anchoring keeps the viewport from jumping. */

.cpv2-sticky {
    position: sticky;
    top: var(--header-h, 52px);
    z-index: 90; /* above page content, below the 100 tab bar */
    background-color: #FAFAF7; /* opaque --paper */
    border-bottom: 1px solid var(--border, #E5E5E0);
    box-shadow: 0 4px 12px -4px rgba(0, 0, 0, 0.08);
    display: none;
}

.cpv2-sticky--shown {
    display: block;
}

.cpv2-sticky-inner {
    display: flex;
    align-items: center;
    gap: var(--s-3, 12px);
    min-height: 48px;
    padding-block: 6px;
    /* Now rendered inside .cpv2-shell-main (right column of the
       full-bleed shell) so we add our own horizontal padding instead
       of inheriting from .content-container. Caps width to match
       .cpv2-shell-inner (1600 px) and centres within the right column. */
    padding-inline: var(--s-10, 40px);
    max-width: calc(1600px + var(--s-10, 40px) * 2);
    margin-inline: auto;
    width: 100%;
    box-sizing: border-box;
}

.cpv2-sticky-av {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    color: var(--white, #fff);
    font: 600 12px/1 var(--font-sans);
    flex-shrink: 0;
    background: var(--indigo-600, #5B57DB); /* overridden by inline style hash */
}

.cpv2-sticky-text {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
    flex: 1;
}

.cpv2-sticky-name {
    color: var(--ink);
    font: 600 14px/1.2 var(--font-sans);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.cpv2-sticky-edrpou {
    color: var(--muted);
    font: 500 11px/1.2 var(--font-mono);
    font-feature-settings: var(--font-feature-tnum);
    letter-spacing: 0.02em;
}

.cpv2-sticky-risk {
    display: inline-flex;
    align-items: center;
    gap: var(--s-2, 8px);
    flex-shrink: 0;
}

.cpv2-sticky-risk-dot {
    flex-shrink: 0;
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.cpv2-sticky-risk-dot--forest { background: var(--forest); }
.cpv2-sticky-risk-dot--amber  { background: var(--amber); }
.cpv2-sticky-risk-dot--coral  { background: var(--coral); }

.cpv2-sticky-risk-val {
    color: var(--ink);
    font: 600 14px/1 var(--font-mono);
    font-feature-settings: var(--font-feature-tnum);
}

.cpv2-sticky-risk-lbl {
    padding: 2px 8px;
    border-radius: var(--r-pill, 100px);
    font: 500 11px/1.4 var(--font-sans);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* Same colour-band classes as RiskMeter's status pill. */
.cpv2-sticky-risk-lbl.ps-rm-status--forest { background: var(--forest-bg); color: var(--forest); }
.cpv2-sticky-risk-lbl.ps-rm-status--amber  { background: var(--amber-bg);  color: var(--amber); }
.cpv2-sticky-risk-lbl.ps-rm-status--coral  { background: var(--coral-bg);  color: var(--coral); }

/* ============================================================
   Manual-collapse propagation
   ----------------------------------------------------------------
   When the user clicks "⟨ Згорнути" inside CompanySidebar, the
   .cs--collapsed class lands on the inner <aside class="cs"> — but
   the OUTER .cpv2-shell-side wrapper (and the shell grid track)
   stay 240 px because Blazor scoped CSS can't reach across
   component scopes. Result: icons render centered inside a 240-px
   box with empty side gutters; perceived as "sidebar expanded /
   content empty" on wide viewports.

   The :has() rule below bridges the two scopes (no Blazor scoping
   on this file — it's a plain global stylesheet) so the grid track
   actually shrinks when the inner .cs--collapsed class flips on.
   ============================================================ */
.cpv2-shell:has(.cs--collapsed) {
    grid-template-columns: 64px minmax(0, 1fr);
}

.cpv2-shell-side:has(.cs--collapsed) {
    width: 64px;
}

/* ============================================================
   Print stylesheet (Експорт PDF — window.print())
   ----------------------------------------------------------------
   MvsTabV2 / other tabs trigger the browser's native print dialog;
   users select "Save as PDF". Hide the app chrome so the printed
   page is the content block only, on white, with no scroll
   artefacts.
   ============================================================ */
@media print {
    /* Hide global chrome */
    .ps-tabbar,
    .cpv2-shell-side,
    .cpv2-sticky,
    .cpv2-bc,
    .cpv2-toolbar,
    .cpv2-error-actions,
    /* MVS-specific: hide interactive controls in the printed output */
    .ps-mv-actionbar-actions,
    .ps-mv-filters {
        display: none !important;
    }

    /* Reset full-bleed shell to a printable single column */
    .cpv2-shell {
        display: block !important;
        width: 100% !important;
        background: white !important;
    }

    .cpv2-shell-pad,
    .cpv2-shell-inner {
        padding: 0 !important;
        max-width: none !important;
        margin: 0 !important;
    }

    /* Force opaque card backgrounds so print drivers don't drop them */
    .ps-mv-card,
    .ps-mv-alert {
        break-inside: avoid;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}
