.wellbeing-analysis {
    margin-top: 12px;
    padding: 13px;
    border: 1px solid var(--line);
    border-radius: 17px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: var(--shadow);
}

.wellbeing-analysis[hidden] {
    display: none;
}

.wellbeing-analysis__heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.wellbeing-analysis__heading p,
.wellbeing-analysis__heading h2 {
    margin: 0;
}

.wellbeing-analysis__heading p {
    color: var(--muted);
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.wellbeing-analysis__heading h2 {
    margin-top: 2px;
    font-size: clamp(1.05rem, 3vw, 1.35rem);
}

.wellbeing-analysis__periods {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 3px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface-soft);
}

.wellbeing-analysis__periods button {
    min-height: 30px;
    padding: 0 8px;
    border: 0;
    border-radius: 7px;
    color: var(--muted);
    background: transparent;
    font-size: 0.68rem;
    font-weight: 850;
}

.wellbeing-analysis__periods button.is-active {
    color: #fff;
    background: var(--ink);
}

.wellbeing-analysis__stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
    margin-bottom: 10px;
}

.wellbeing-analysis__stats article {
    padding: 9px 10px;
    border-radius: 11px;
    background: var(--surface-soft);
}

.wellbeing-analysis__stats span,
.wellbeing-analysis__stats strong {
    display: block;
}

.wellbeing-analysis__stats span {
    color: var(--muted);
    font-size: 0.66rem;
    font-weight: 750;
}

.wellbeing-analysis__stats strong {
    margin-top: 2px;
    font-size: 1rem;
}

.wellbeing-analysis__table-wrap {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 12px;
}

.wellbeing-analysis__table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.76rem;
}

.wellbeing-analysis__table th,
.wellbeing-analysis__table td {
    width: 1%;
    padding: 7px 8px;
    border-bottom: 1px solid var(--line);
    text-align: center;
    white-space: nowrap;
}

.wellbeing-analysis__table th:first-child,
.wellbeing-analysis__table td:first-child {
    width: auto;
    text-align: left;
}

.wellbeing-analysis__table thead th {
    color: var(--muted);
    background: var(--surface-soft);
    font-size: 0.66rem;
    text-transform: uppercase;
    letter-spacing: 0.035em;
}

.wellbeing-analysis__table tbody tr:last-child > * {
    border-bottom: 0;
}

.wellbeing-analysis__table tbody tr:first-child {
    background: #eef5ff;
}

.wellbeing-correlation {
    display: inline-grid;
    min-width: 46px;
    place-items: center;
    padding: 4px 6px;
    border-radius: 8px;
    color: #3f4f66;
    background: #eef1f5;
    font-weight: 900;
    font-variant-numeric: tabular-nums;
}

.wellbeing-correlation--positive {
    color: #12603a;
    background: #ddf6e7;
}

.wellbeing-correlation--negative {
    color: #963544;
    background: #ffe6e9;
}

.wellbeing-correlation--neutral {
    color: #775613;
    background: #fff2c9;
}

.wellbeing-analysis__legend,
.wellbeing-analysis__status {
    margin: 8px 2px 0;
    color: var(--muted);
    font-size: 0.68rem;
    line-height: 1.45;
}

.wellbeing-analysis__status:empty {
    display: none;
}

@media (max-width: 640px) {
    .wellbeing-analysis__heading {
        align-items: stretch;
        flex-direction: column;
    }

    .wellbeing-analysis__periods {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
    }

    .wellbeing-analysis__stats {
        grid-template-columns: 1fr 1fr;
    }

    .wellbeing-analysis__stats article:first-child {
        grid-column: 1 / -1;
    }

    .wellbeing-analysis__table {
        width: max-content;
        min-width: 100%;
    }
}
