﻿/* Shared Hyper analytics components. Keep project-specific rules in local CSS. */

.stat-shell {
    max-width: 1500px;
    margin: 0 auto;
    color: var(--MFText);
}

.stat-page-layout {
    align-items: flex-start;
}

.stat-page-sidebar {
    align-self: flex-start;
}

.stat-side-nav {
    margin-bottom: 5rem;
}

.stat-side-nav-title {
    margin-bottom: 0.9rem;
    color: var(--secondary);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    line-height: 1.2;
    text-transform: uppercase;
}

.stat-side-nav-section + .stat-side-nav-section {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(95, 112, 127, 0.1);
}

.stat-side-nav-heading {
    display: block;
    margin-bottom: 0.55rem;
    color: var(--secondary);
    font-size: 0.8125rem;
    font-weight: 700;
    line-height: 1.3;
    text-decoration: none;
}

.stat-side-nav-heading:hover,
.stat-side-nav-heading.is-current {
    color: var(--primary);
}

.stat-side-nav-links {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.stat-side-nav-link {
    display: block;
    padding: 0.25rem 0;
    color: var(--MFText);
    font-size: 0.8125rem;
    line-height: 1.3;
    text-decoration: none;
}

.stat-side-nav-link:hover,
.stat-side-nav-link.is-active {
    color: var(--primary);
}

.stat-side-nav-link.is-active {
    font-weight: 600;
}

.stat-mobile-nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.stat-mobile-nav-panel {
    margin-top: 0.5rem;
    padding: 1rem 1rem 0.5rem;
    background: #fff;
    border: 1px solid rgba(95, 112, 127, 0.12);
    border-radius: 0.9rem;
    box-shadow: 0 0 35px rgba(154, 161, 171, 0.15);
}

.stat-mobile-nav-panel .stat-side-nav-title {
    display: none;
}

.stat-summary-card {
    margin-bottom: 1.5rem;
}

.stat-summary-strip {
    gap: 1rem;
}

.stat-section {
    scroll-margin-top: 1rem;
}

.stat-section + .stat-section {
    margin-top: 1rem;
}

.stat-section-heading {
    margin-bottom: 1rem;
}

.stat-grid-row {
    row-gap: 1rem;
}

.stat-kpi-row--compact {
    row-gap: 0;
}

.stat-kpi-title {
    color: var(--secondary);
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.2;
    text-transform: uppercase;
}

.stat-kpi-title--compact {
    font-size: 0.8rem;
    letter-spacing: -0.01em;
}

.stat-kpi-card-layout {
    display: flex;
    min-height: 7.5rem;
    flex-direction: column;
}

.stat-kpi-main {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 70px;
    gap: 0.75rem;
    align-items: start;
}

.stat-kpi-art {
    display: block;
    width: 70px;
    height: 70px;
    min-height: 70px;
    flex: 0 0 auto;
    background-color: var(--MFBg);
    background-repeat: no-repeat;
    background-size: 60px;
    background-position: center;
    border-radius: 1rem;
}

.stat-kpi-content {
    display: flex;
    min-width: 0;
    flex-direction: column;
    justify-content: center;
}

.stat-kpi-value {
    display: block;
    margin-top: 0.75rem;
    color: var(--MFText);
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.05;
    white-space: nowrap;
}

.stat-kpi-change-row {
    margin-top: 0.5rem;
    line-height: 1;
}

.stat-kpi-change {
    flex: 0 0 auto;
    padding: 0.2rem 0.38rem;
    font-size: 0.6875rem;
    line-height: 1.1;
    white-space: nowrap;
}

.stat-kpi-description {
    width: 100%;
    margin-top: 0.65rem;
    line-height: 1.35;
}

.stat-chart-wrap {
    position: relative;
    height: 260px;
}

.stat-chart-wrap--sm {
    height: 200px;
}

.stat-chart-card-body {
    display: flex;
    flex-direction: column;
}

.stat-chart-wrap--fill {
    min-height: 200px;
    height: auto;
    flex: 1 1 200px;
}

.stat-chart-wrap--lg {
    height: 320px;
}

.stat-pie-side {
    display: grid;
    min-height: 16rem;
    grid-template-columns: minmax(9rem, 0.9fr) minmax(0, 1.1fr);
    gap: 1rem;
    align-items: center;
}

.stat-pie-side-chart {
    position: relative;
    width: 100%;
    max-width: 10.5rem;
    height: 10.5rem;
    justify-self: center;
}

.stat-pie-side--compact {
    min-height: 8rem;
    grid-template-columns: minmax(7.75rem, 0.8fr) minmax(0, 1.2fr);
}

.stat-pie-side--compact .stat-pie-side-chart {
    max-width: 7.75rem;
    height: 7.75rem;
}

.stat-pie-side-center {
    position: absolute;
    top: 50%;
    left: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--secondary);
    line-height: 1.1;
    pointer-events: none;
    transform: translate(-50%, -50%);
}

.stat-pie-side-center strong {
    color: var(--MFText);
    font-size: 1.2rem;
    font-variant-numeric: tabular-nums;
}

.stat-pie-side-center span {
    margin-top: 0.2rem;
    font-size: 0.6875rem;
    text-transform: uppercase;
}

.stat-pie-side-legend {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 0.75rem;
}

.stat-pie-side-legend-item {
    display: grid;
    grid-template-columns: 10px minmax(0, 1fr);
    gap: 0.5rem;
    align-items: start;
}

.stat-pie-side-legend-dot {
    width: 10px;
    height: 10px;
    margin-top: 0.2rem;
    border-radius: 0.2rem;
}

.stat-pie-side-legend-content {
    display: flex;
    min-width: 0;
    flex-direction: column;
}

.stat-pie-side-legend-name {
    display: block;
    min-width: 0;
    color: var(--secondary);
    font-size: 0.75rem;
    line-height: 1.3;
}

.stat-pie-side-legend-value {
    display: block;
    margin-top: 0.15rem;
    color: var(--MFText);
    font-size: 0.75rem;
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    text-align: left;
    white-space: nowrap;
}

.stat-hlist {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.stat-hlist--sm {
    gap: 0.5rem;
}

.stat-hlist-item {
    display: block;
}

.stat-hlist-bar {
    width: 100%;
    height: 6px;
    margin-bottom: 0.35rem;
    overflow: hidden;
    background: rgba(0, 97, 150, 0.08);
    border-radius: 999px;
}

.stat-hlist--sm .stat-hlist-bar {
    height: 6px;
    min-height: 6px;
    max-height: 6px;
    box-sizing: border-box;
    line-height: 0;
}

.stat-hlist--sm .stat-hlist-fill {
    height: 6px;
    min-height: 6px;
    max-height: 6px;
    box-sizing: border-box;
    line-height: 0;
}

.stat-hlist--md .stat-hlist-bar {
    height: 12px;
    min-height: 12px;
    max-height: 12px;
    box-sizing: border-box;
    line-height: 0;
}

.stat-hlist--md .stat-hlist-fill {
    height: 12px;
    min-height: 12px;
    max-height: 12px;
    box-sizing: border-box;
    line-height: 0;
}

.stat-hlist--xl .stat-hlist-bar {
    height: 28px;
    min-height: 28px;
    max-height: 28px;
    box-sizing: border-box;
    border-radius: 0.25rem;
    line-height: 0;
}

.stat-hlist--xl .stat-hlist-fill {
    height: 28px;
    min-height: 28px;
    max-height: 28px;
    box-sizing: border-box;
    border-radius: 0.25rem;
    line-height: 0;
}

.stat-hlist--xl .stat-hlist-stack {
    border-radius: 0.25rem;
}

.stat-hlist-fill {
    display: block;
    height: 100%;
    background: var(--primary);
    border-radius: 999px;
}

.stat-hlist-fill--sand {
    background: var(--MFSand);
}

.stat-hlist-fill--secondary {
    background: var(--secondary);
}

.stat-hlist-fill--danger {
    background: var(--danger);
}

.stat-hlist--thick .stat-hlist-bar {
    height: 12px;
    border-radius: 0.25rem;
}

.stat-hlist--thick .stat-hlist-stack {
    border-radius: 0.25rem;
}

.stat-hlist-stack {
    display: flex;
    height: 100%;
    overflow: hidden;
    border-radius: 999px;
}

.stat-hlist-segment {
    display: block;
    height: 100%;
}

.stat-hlist-meta {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
}

.stat-hlist-label {
    color: var(--secondary);
    font-size: 0.875rem;
    line-height: 1.35;
}

.stat-hlist-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem 1rem;
    margin-bottom: 1rem;
}

.stat-hlist-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--secondary);
    font-size: 0.8125rem;
}

.stat-hlist-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 0.2rem;
}

.stat-segmented-bar {
    display: flex;
    width: 100%;
    height: 28px;
    overflow: hidden;
    background: var(--MFBg);
    border-radius: 0.25rem;
}

.stat-segmented-section {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
}

.stat-segmented-section--primary {
    background: var(--primary);
}

.stat-segmented-section--sand {
    background: var(--MFSand);
}

.stat-segmented-section--secondary {
    background: var(--secondary);
}

.stat-segmented-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1.5rem;
    margin-top: 0.85rem;
}

.stat-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--secondary);
    font-size: 0.8125rem;
}

.stat-legend-swatch {
    width: 10px;
    height: 10px;
    border-radius: 0.2rem;
}

.stat-tone-primary {
    background: var(--primary);
}

.stat-tone-sand {
    background: var(--MFSand);
}

.stat-tone-secondary {
    background: var(--secondary);
}

.stat-tone-danger {
    background: var(--danger);
}

.stat-tone-success {
    background: var(--success);
}

.stat-tone-info {
    background: var(--info);
}

.stat-tone-warning {
    background: var(--warning);
}

.stat-tone-dark {
    background: var(--dark);
}

.stat-tone-primary-muted {
    background: var(--primary);
    opacity: 0.65;
}

/* «Без МИС»: хвост полосы, а не ещё один поставщик. Тон повторяет подложку
   дорожки, поэтому читается как пустое место. */
.stat-tone-empty {
    background: rgba(0, 97, 150, 0.18);
}

.stat-tone-secondary-muted {
    background: var(--secondary);
    opacity: 0.65;
}

.stat-treemap {
    display: flex;
    min-height: 16rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.stat-treemap-tile {
    display: flex;
    min-width: calc(33.333% - 0.5rem);
    min-height: 6.5rem;
    flex-direction: column;
    justify-content: space-between;
    padding: 0.85rem;
    overflow: hidden;
    color: #fff;
}

.stat-treemap--balanced {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: minmax(8rem, 1fr);
}

.stat-treemap--balanced .stat-treemap-tile {
    min-width: 0;
    min-height: 8rem;
}

.stat-treemap-label {
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1.25;
}

.stat-treemap-value {
    font-size: 1.35rem;
    font-weight: 700;
}

.stat-heatmap-scroll {
    overflow-x: auto;
    padding-bottom: 0.35rem;
}

.stat-heatmap-grid {
    display: grid;
    min-width: 760px;
    grid-template-columns: 32px repeat(12, minmax(42px, 1fr));
    gap: 0.3rem;
    align-items: center;
}

.stat-heatmap-hour,
.stat-heatmap-day {
    color: var(--secondary);
    font-size: 0.6875rem;
    text-align: center;
}

.stat-heatmap-day {
    text-align: left;
}

.stat-heatmap-cell {
    display: inline-flex;
    min-height: 28px;
    align-items: center;
    justify-content: center;
    border-radius: 0.25rem;
    font-size: 0.625rem;
    font-weight: 600;
    line-height: 1;
}

.stat-morph-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
}

.stat-morph-value {
    display: inline-block;
    margin-bottom: 0.45rem;
    color: var(--primary);
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1;
}

.stat-record {
    display: grid;
    min-height: 60px;
    grid-template-columns: 60px minmax(2rem, 1fr) auto minmax(2rem, 1fr) 60px;
    gap: 0.75rem;
    align-items: center;
    padding: 0.8rem 1.25rem;
}

.stat-record-end {
    display: block;
    width: 60px;
    height: 32px;
    background: var(--primary);
    border-radius: 0.5rem;
    opacity: 0.86;
}

.stat-record-pointer {
    position: relative;
    display: block;
    height: 1px;
    background: var(--secondary);
}

.stat-record-pointer--left::before,
.stat-record-pointer--right::after {
    position: absolute;
    top: -3px;
    width: 0;
    height: 0;
    border-top: 3.5px solid transparent;
    border-bottom: 3.5px solid transparent;
    content: "";
}

.stat-record-pointer--left::before {
    left: 0;
    border-right: 6px solid var(--secondary);
}

.stat-record-pointer--right::after {
    right: 0;
    border-left: 6px solid var(--secondary);
}

.stat-record-value {
    color: var(--MFText);
    font-size: 1.25rem;
    white-space: nowrap;
}

.stat-timeline {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.75rem;
}

.stat-timeline-item {
    padding: 0.85rem;
}

.stat-timeline-date {
    display: block;
    margin-bottom: 0.45rem;
    color: var(--secondary);
    font-size: 0.75rem;
}

.stat-insight-grid {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.stat-insight {
    padding: 0.9rem 1rem;
    background: #fff;
    border: 1px solid var(--MFBorder);
    border-radius: 0.85rem;
}

.stat-insight-title {
    margin-bottom: 0.35rem;
    color: var(--secondary);
    font-size: 0.75rem;
    line-height: 1.2;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.stat-insight-text {
    color: var(--MFText);
    font-size: 0.75rem;
    line-height: 1.45;
}

.stat-tooltip {
    position: fixed;
    z-index: 1080;
    max-width: 240px;
    padding: 0.45rem 0.6rem;
    pointer-events: none;
    color: #fff;
    background: var(--MFText);
    border-radius: 0.35rem;
    box-shadow: 0 0.35rem 1rem rgba(31, 45, 61, 0.18);
    font-size: 0.75rem;
    line-height: 1.35;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 80ms ease, transform 80ms ease;
}

.stat-tooltip.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.stat-table th {
    color: var(--secondary);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}

.stat-table td {
    font-variant-numeric: tabular-nums;
}

.stat-data-table th {
    border-top: 0;
    color: var(--secondary);
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    vertical-align: middle;
}

.stat-data-table td {
    font-variant-numeric: tabular-nums;
    vertical-align: middle;
}

.stat-data-table th:first-child,
.stat-data-table td:first-child {
    min-width: 0;
    white-space: normal;
}

.stat-data-table .stat-table-number {
    font-variant-numeric: tabular-nums;
    text-align: right;
    white-space: nowrap;
}

.stat-table-scroll {
    max-height: 560px;
    overflow: auto;
}

.stat-table-scroll .table {
    border-collapse: separate;
    border-spacing: 0;
}

.stat-table-scroll th {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.stat-table-scroll th:hover {
    color: var(--primary);
}

.stat-table-scroll tbody tr:nth-child(even) {
    background: rgba(238, 244, 248, 0.45);
}

.stat-table-scroll tbody tr:hover {
    background: rgba(0, 97, 150, 0.05);
}

.stat-table-scroll tbody tr:last-child td {
    border-bottom: 0;
}

@media (max-width: 767.98px) {
    .stat-table-scroll {
        max-height: none;
    }
}

.stat-component-gap {
    gap: 0.65rem;
}


.stat-method-card.is-collapsed .stat-method-body {
    display: none;
}

.stat-method-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0 !important;
}

.stat-method-card .header-title {
    margin-bottom: 0 !important;
}

.stat-method-title {
    display: inline-flex;
    min-width: 0;
    flex: 1 1 auto;
    align-items: center;
    padding: 0;
    color: var(--MFText);
    background: transparent;
    border: 0;
    text-align: left;
    cursor: pointer;
}

.stat-method-title:focus-visible {
    outline: 2px solid rgba(0, 97, 150, 0.3);
    outline-offset: 0.25rem;
}

.stat-method-help {
    flex: 0 0 auto;
    color: var(--MFText);
    font-size: 1.5rem;
}

.stat-method-toggle {
    width: 2rem;
    height: 2rem;
    flex: 0 0 auto;
    align-self: center;
    line-height: 1;
}

.stat-method-chevron {
    display: block;
    width: 1rem;
    height: 1rem;
    color: var(--MFText);
    transform: rotate(0deg);
    transform-origin: 50% 50%;
    transition: transform 0.18s ease;
}

.stat-method-card:not(.is-collapsed) .stat-method-chevron {
    transform: rotate(180deg);
}

.stat-method-body {
    margin-top: 1rem;
    color: var(--secondary);
    font-size: 0.8125rem;
    line-height: 1.55;
    white-space: pre-line;
}

/* Dashboard filter card and controlled dropdowns */
.stat-filter-row {
    row-gap: 0.15rem;
}

.stat-filter-row > .form-group {
    min-width: 0;
}

.stat-filter-label {
    display: block;
    margin-bottom: 0.35rem;
    color: var(--secondary);
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.stat-filter-actions-row {
    display: flex;
    align-items: center;
    margin-top: 0.15rem;
    padding-top: 0.7rem;
    border-top: 1px solid rgba(95, 112, 127, 0.08);
}

.stat-filter-actions {
    display: flex;
    width: 100%;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    justify-content: space-between;
}

.stat-year-picker,
.stat-select {
    position: relative;
    width: 100%;
    min-width: 0;
}

.stat-year-trigger,
.stat-select-trigger {
    position: relative;
    min-width: 0;
    max-width: 100%;
    padding-right: 2rem;
    overflow: hidden;
    color: var(--MFText);
    background: #fff;
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.stat-year-trigger::after,
.stat-select-trigger::after {
    position: absolute;
    top: 50%;
    right: 0.75rem;
    color: var(--secondary);
    content: "▾";
    transform: translateY(-50%);
}

.stat-year-panel,
.stat-select-panel {
    position: absolute;
    z-index: 1250;
    top: calc(100% + 0.35rem);
    left: 0;
    display: none;
    width: 100%;
    min-width: 290px;
    max-height: 280px;
    padding: 0.65rem;
    overflow-y: auto;
    background: #fff;
    border: 1px solid var(--MFBorder);
    box-shadow: 0 12px 30px rgba(49, 58, 70, 0.12);
}

.stat-year-picker.is-open .stat-year-panel,
.stat-select.is-open .stat-select-panel {
    display: block;
}

.stat-year-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.05rem 0.45rem;
}

.stat-year-option {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin: 0;
    padding: 0.38rem 0.45rem;
    color: var(--MFText);
    font-size: 0.8rem;
    cursor: pointer;
}

.stat-year-option:hover,
.stat-select-option:hover,
.stat-select-option:focus,
.stat-select-option.is-active {
    color: var(--primary);
    background: var(--MFBg);
    outline: 0;
}

.stat-year-option input {
    accent-color: var(--primary);
}

.stat-year-option--all,
.stat-select-option:first-child {
    margin-bottom: 0.25rem;
    border-bottom: 1px solid rgba(95, 112, 127, 0.08);
    font-weight: 700;
}

.stat-native-select {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.stat-select-option {
    display: block;
    width: 100%;
    padding: 0.38rem 0.45rem;
    overflow-wrap: anywhere;
    color: var(--MFText);
    background: transparent;
    border: 0;
    font-size: 0.8rem;
    text-align: left;
}

.stat-filter-row > .form-group:last-child .stat-select-panel {
    right: 0;
    left: auto;
}

@media (min-width: 1200px) {
    .stat-filter-row {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr)) repeat(2, minmax(0, 1.5fr));
        gap: 0 0.5rem;
        margin-right: 0;
        margin-left: 0;
    }

    .stat-filter-row > .form-group {
        width: auto;
        max-width: none;
        padding-right: 0;
        padding-left: 0;
    }
}


@media (max-width: 1199.98px) {
    .stat-mobile-nav-panel {
        max-height: none;
        overflow: visible;
    }
}

@media (max-width: 767.98px) {
    .stat-filter-actions .btn {
        flex: 1 1 auto;
    }

    .stat-year-panel,
    .stat-select-panel {
        right: auto;
        left: 0;
        min-width: 100%;
    }

    .stat-pie-side {
        grid-template-columns: 1fr;
    }

    .stat-pie-side-legend {
        width: 100%;
    }

    .stat-shell {
        padding-right: 0.75rem !important;
        padding-left: 0.75rem !important;
    }

    .stat-kpi-row > [class*="col-"] {
        flex: 0 0 100%;
        max-width: 100%;
    }

    .stat-chart-wrap {
        height: 230px;
    }

    .stat-chart-wrap--lg {
        height: 280px;
    }

    .stat-segmented-bar {
        height: 24px;
    }

    .stat-segmented-section {
        font-size: 0.6875rem;
    }

    .stat-treemap-tile {
        min-width: 100%;
    }

    .stat-treemap--balanced {
        grid-template-columns: 1fr;
    }

    .stat-timeline {
        grid-template-columns: 1fr;
    }

    .stat-record {
        grid-template-columns: 42px 1fr auto 1fr 42px;
        padding-right: 1rem;
        padding-left: 1rem;
    }

    .stat-record-end {
        width: 42px;
        height: 24px;
    }
}
