body.ma-page {
    min-height: 100vh;
}

.ma-page-layout {
    display: flex;
    flex-direction: column;
    flex: 1 0 auto;
    min-height: 100vh;
}

.ma-container {
    width: 100%;
    padding-bottom: 24px;
}

/* Мобилка: как rate_calculator / cover_letter — ширина контента 600px */
@media (max-width: 1279px) {
    main.container.ma-container {
        width: 100%;
        max-width: 600px;
        margin-left: auto;
        margin-right: auto;
        box-sizing: border-box;
    }

    #ma-index-tooltip {
        width: calc(100vw - 32px);
        max-width: min(600px, calc(100vw - 32px));
        box-sizing: border-box;
    }
}

.ma-title-section {
    margin-top: 16px;
    margin-bottom: 16px;
}

.ma-title {
    margin: 0 0 8px;
    font-size: var(--fs-32);
    letter-spacing: var(--ls-32);
    line-height: var(--lh-32);
    font-weight: var(--fw-semibold);
    color: var(--text-color);
}

.ma-subtitle {
    margin: 0;
    color: var(--text-color);
    font-size: var(--fs-16);
    line-height: var(--lh-16);
    letter-spacing: var(--ls-16);
}

.ma-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 4px;
}

.ma-chips .filter-chip {
    background-color: var(--surface-primary);
}

html.dark-theme .ma-chips .filter-chip {
    background-color: var(--surface-primary);
}

.ma-chips .filter-chip.active,
html.dark-theme .ma-chips .filter-chip.active {
    background-color: var(--accent-color);
}

.ma-chips .filter-chip.active .chip-text {
    color: var(--surface-primary);
}

html.dark-theme .ma-chips .filter-chip.active .chip-text {
    color: #FFFFFF;
}

.ma-loader {
    width: 100%;
    min-height: 360px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-primary);
    border-radius: 24px;
}

.ma-is-hidden {
    display: none !important;
}

.ma-kpi-grid,
.ma-chart-grid {
    display: grid;
    gap: 4px;
}

.ma-kpi-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-bottom: 4px;
    align-items: start;
}

.ma-chart-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-auto-rows: 1fr;
    align-items: stretch;
}

.ma-kpi-card,
.ma-chart-card {
    background: var(--surface-primary);
    border-radius: 24px;
    padding: 20px;
    min-width: 0;
}

.ma-kpi-card {
    box-sizing: border-box;
    height: fit-content;
}

.ma-chart-card {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.ma-kpi-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.ma-kpi-label,
.ma-chart-note {
    color: var(--text-muted);
    font-size: var(--fs-14);
    line-height: var(--lh-14);
    letter-spacing: var(--ls-14);
}

.ma-kpi-label {
    flex: 1 1 auto;
    min-width: 0;
    min-height: calc(var(--fs-14) * var(--lh-14) * 2);
    display: flex;
    align-items: center;
}

.ma-kpi-card--index .ma-kpi-label {
    gap: 4px;
}

.ma-kpi-value-wrap {
    flex: 0 0 auto;
    display: flex;
    flex-direction: row;
    align-items: baseline;
    justify-content: flex-end;
    gap: 8px;
    min-width: 0;
}

.ma-kpi-value {
    flex: 0 0 auto;
    margin-top: 0;
    text-align: right;
    font-size: var(--fs-32);
    line-height: var(--lh-32);
    letter-spacing: var(--ls-32);
    font-weight: var(--fw-semibold);
    color: var(--text-color);
    white-space: nowrap;
}

.ma-kpi-delta {
    display: flex;
    align-items: baseline;
    justify-content: flex-end;
    gap: 4px;
    font-size: var(--fs-14);
    line-height: var(--lh-14);
    letter-spacing: var(--ls-14);
    white-space: nowrap;
}

.ma-kpi-delta-change {
    font-weight: var(--fw-medium, 500);
}

.ma-kpi-delta-change.is-up {
    color: var(--success-color, #3AC271);
}

.ma-kpi-delta-change.is-down {
    color: var(--danger, #CC5C6F);
}

.ma-kpi-delta-change.is-flat {
    color: var(--text-muted);
}

.ma-kpi-delta-suffix {
    color: var(--text-muted);
}

.ma-chart-title {
    margin: 0 0 16px;
    min-height: calc(var(--lh-18) * 2);
    font-size: var(--fs-18);
    line-height: var(--lh-18);
    letter-spacing: var(--ls-18);
    font-weight: var(--fw-semibold);
    color: var(--text-color);
    text-transform: lowercase;
}

.ma-chart-body {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-height: 248px;
}

.ma-chart-note {
    margin-top: auto;
    padding-top: 16px;
}

.ma-bar-list {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 6px;
}

.ma-bar-row {
    display: grid;
    grid-template-columns: minmax(88px, 34%) 1fr 88px;
    align-items: center;
    column-gap: 8px;
}

.ma-bar-label,
.ma-bar-value {
    font-size: var(--fs-14);
    line-height: var(--lh-14);
    color: var(--text-color);
}

.ma-bar-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ma-bar-value {
    text-align: right;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.ma-bar-track {
    height: 10px;
    border-radius: 999px;
    background: var(--surface-secondary);
    overflow: hidden;
    transform: translateX(48px);
}

.ma-bar-fill {
    height: 100%;
    border-radius: 999px;
    background: var(--accent-color);
    transform-origin: left center;
    animation: ma-grow-x 0.45s ease;
}

.ma-donut-layout {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    gap: 16px;
    min-height: 248px;
    min-width: 0;
}

.ma-donut-wrap {
    position: relative;
    flex: 0 0 160px;
    width: 160px;
    height: 160px;
}

.ma-donut-legend {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
    min-width: 0;
    margin: 0;
    padding: 0;
    list-style: none;
}

.ma-donut-legend-item {
    display: grid;
    grid-template-columns: 12px minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
}

.ma-donut-swatch {
    width: 12px;
    height: 12px;
    border-radius: 3px;
}

.ma-salary-list {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 6px;
}

.ma-salary-row {
    display: grid;
    grid-template-columns: minmax(88px, 34%) 1fr 88px;
    align-items: center;
    column-gap: 8px;
}

.ma-salary-track {
    position: relative;
    height: 10px;
    transform: translateX(48px);
    overflow: visible;
    touch-action: none;
}

.ma-salary-line {
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    height: 2px;
    border-radius: 999px;
    background: var(--filter-divider);
    transform: translateY(-50%);
}

.ma-salary-dot {
    position: absolute;
    top: 50%;
    left: var(--ma-dot-left, 0%);
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--accent-color);
    transform: translate(-50%, -50%);
    animation: ma-dot-in 0.45s ease;
    cursor: grab;
    touch-action: none;
    z-index: 2;
}

.ma-salary-dot::before {
    content: '';
    position: absolute;
    inset: -8px;
    border-radius: 50%;
    pointer-events: auto;
    touch-action: none;
}

.ma-salary-dot.is-dragging {
    cursor: grabbing;
    box-shadow: 0 0 0 5px color-mix(in srgb, var(--accent-color) 22%, transparent);
}

.ma-money-particle {
    position: absolute;
    top: 50%;
    z-index: 1;
    pointer-events: none;
    font-size: 19px;
    font-weight: var(--fw-semibold);
    line-height: 1;
    background: linear-gradient(
        90deg,
        #4DB288,
        #FED88E,
        #FF7733,
        #FED88E,
        #4DB288,
        #FED88E,
        #FF7733,
        #FED88E,
        #4DB288
    );
    background-size: 200% 100%;
    background-position: 0% 50%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 1px 9px color-mix(in srgb, #4DB288 55%, transparent);
    transform: translate(-50%, -50%) scale(0.65);
    animation:
        ma-money-fall 520ms ease-out forwards,
        ma-money-gradient-wave 520ms linear forwards;
}

html:not(.dark-theme) .ma-money-particle {
    background-image: linear-gradient(
        90deg,
        #3E9A70,
        #E3B34C,
        #EE6A2E,
        #E3B34C,
        #3E9A70,
        #E3B34C,
        #EE6A2E,
        #E3B34C,
        #3E9A70
    );
    text-shadow: 0 1px 9px color-mix(in srgb, #3E9A70 55%, transparent);
}

html.dark-theme .ma-money-particle {
    text-shadow: 0 1px 9px color-mix(in srgb, #4DB288 55%, transparent);
}

.ma-empty {
    flex: 1 1 auto;
    min-height: 248px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--text-muted);
    font-size: var(--fs-16);
}

.ma-vs {
    flex: 1 1 auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    height: 248px;
    min-height: 248px;
    align-items: end;
}

.ma-vs > .ma-vs-item {
    flex: 1 1 auto;
    min-height: 96px;
    animation: ma-grow-y 0.45s cubic-bezier(.22, 1, .36, 1) both;
}

.ma-vs > .ma-vs-item:nth-child(2) {
    animation-delay: 60ms;
}

.ma-vs-item {
    background: var(--surface-secondary);
    border-radius: 16px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 8px;
    box-sizing: border-box;
}

.ma-vs-item .ma-kpi-label {
    min-height: 0;
    align-items: flex-start;
}

.ma-vs-value {
    margin-top: auto;
    font-size: var(--fs-32);
    font-weight: var(--fw-semibold);
    color: var(--text-color);
}

@media (max-width: 1279px) {
    .ma-title {
        font-size: var(--fs-24);
        line-height: var(--lh-24);
        letter-spacing: var(--ls-24);
    }

    .ma-kpi-grid,
    .ma-chart-grid {
        grid-template-columns: 1fr;
        gap: 4px;
    }

    .ma-kpi-grid {
        margin-bottom: 4px;
    }

    .ma-chart-grid {
        grid-auto-rows: auto;
        align-items: start;
    }

    .ma-kpi-card,
    .ma-chart-card {
        padding: 16px;
        height: auto;
    }

    .ma-chart-title {
        margin: 0 0 16px;
        min-height: 0;
    }

    .ma-chart-body {
        flex: 0 0 auto;
        min-height: 0;
    }

    .ma-chart-note {
        margin-top: 16px;
        padding-top: 0;
        min-height: 0;
    }

    .ma-donut-layout {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        min-height: 0;
    }

    .ma-donut-wrap {
        flex: 0 0 auto;
        width: 148px;
        height: 148px;
        margin: 0 auto;
    }

    .ma-donut-legend {
        width: 100%;
        justify-content: flex-start;
    }

    .ma-empty,
    .ma-vs {
        flex: 0 0 auto;
        height: auto;
        min-height: 0;
    }

    .ma-bar-row,
    .ma-salary-row {
        grid-template-columns: minmax(0, 1.45fr) minmax(56px, 1fr) 48px;
        column-gap: 10px;
    }

    .ma-bar-track,
    .ma-salary-track {
        transform: none;
    }

    .ma-kpi-value {
        font-size: var(--fs-24);
        line-height: var(--lh-24);
    }

    .ma-kpi-value-wrap {
        flex-direction: column;
        align-items: flex-end;
        gap: 2px;
    }

    .ma-chips {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 0;
        margin-bottom: 4px;
        scrollbar-width: none;
    }

    .ma-chips::-webkit-scrollbar {
        display: none;
    }
}

@keyframes ma-grow-x {
    from { transform: scaleX(0); }
    to { transform: scaleX(1); }
}

@keyframes ma-grow-y {
    from { clip-path: inset(100% 0 0 round 16px); }
    to { clip-path: inset(0 round 16px); }
}

@keyframes ma-dot-in {
    from {
        left: 0;
        opacity: 0;
    }
    to {
        left: var(--ma-dot-left, 0%);
        opacity: 1;
    }
}

@keyframes ma-money-fall {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.65) rotate(0deg);
    }
    18% {
        opacity: 1;
    }
    100% {
        opacity: 0;
        transform: translate(calc(-50% + var(--ma-money-drift)), calc(-50% + var(--ma-money-fall))) scale(1) rotate(var(--ma-money-rotation));
    }
}

@keyframes ma-money-gradient-wave {
    from {
        background-position: 0% 50%;
    }
    to {
        background-position: 200% 50%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ma-bar-fill,
    .ma-salary-dot,
    .ma-money-particle,
    .ma-vs > .ma-vs-item {
        animation: none;
    }
}
