/* === calc_alimony.css === */
/* Alimony calculator: mode chips, segmented toggles, form sections, result cards */

/* ---- Mode toggle chips (Simple / Profi) ---- */
.calc-mode-toggle {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.calc-mode-chip {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    padding: 6px 14px;
    border-radius: 999px;
    border: 1px solid var(--glass-border);
    background: var(--bg-surface);
    color: var(--text-secondary);
    font-size: 0.88rem;
    font-weight: 500;
    transition: background var(--transition), border-color var(--transition), color var(--transition);
}

.calc-mode-chip:hover {
    border-color: var(--primary-light);
    color: var(--text-main);
}

.calc-mode-chip--active {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--text-on-primary);
}

.calc-mode-chip--active:hover {
    background: var(--primary-light);
    border-color: var(--primary-light);
    color: var(--text-on-primary);
}

.calc-mode-chip__input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

/* ---- Segmented toggle: 3 items ---- */
.segmented-toggle--3 {
    max-width: 100%;
    width: auto;
}

.segmented-toggle--3 .segmented-toggle__option {
    flex: 1 1 auto;
    white-space: nowrap;
}

/* ---- Segmented toggle: 4 items (reuse from date_diff) ---- */
.segmented-toggle--4 {
    max-width: 100%;
    width: 100%;
    gap: 4px;
}

.segmented-toggle--4 .segmented-toggle__option {
    flex: 1 1 0;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 8px 8px;
    font-size: 0.82rem;
}

@media (max-width: 480px) {
    .segmented-toggle--3,
    .segmented-toggle--4 {
        display: flex;
        width: 100%;
        max-width: 100%;
        flex-wrap: wrap;
        justify-content: center;
        gap: 3px;
        padding: 4px;
        border-radius: 10px;
    }
    .segmented-toggle--3 .segmented-toggle__option,
    .segmented-toggle--4 .segmented-toggle__option {
        flex: 1 1 45%;
        font-size: 0.75rem;
        padding: 5px 6px;
        border-radius: 6px;
        white-space: normal;
        line-height: 1.2;
        overflow: visible;
        text-overflow: clip;
    }
}

/* ---- Form sections (extension of style.css .calc-form__section) ---- */
.calc-form__section-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 12px;
    letter-spacing: 0.01em;
}

/* ---- Profi fields container ---- */
.alimony-profi-fields {
    transition: opacity 0.2s ease;
}

/* ---- Badge for manual override ---- */
.badge-manual {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 20px;
    background: var(--warning-bg, rgba(245, 158, 11, 0.12));
    color: var(--warning, #f59e0b);
    font-size: 0.7rem;
    font-weight: 600;
    margin-left: 8px;
    white-space: nowrap;
}

[data-theme="dark"] .badge-manual {
    background: var(--warning-bg, rgba(245, 158, 11, 0.18));
    color: var(--warning, #fbbf24);
}

/* ---- Result cards: base layout ---- */
.calc-result-card {
    padding: 14px 16px;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    background: var(--bg-surface);
    margin-bottom: 10px;
}

.calc-result-card--main {
    border: 2px solid var(--primary);
    background: var(--bg-surface);
}

.calc-result-card--main .calc-result-card__label {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.calc-result-card--main .calc-result-card__value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
    cursor: pointer;
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
}

.calc-result-card--secondary {
    flex: 1 1 0;
    min-width: 0;
}

.calc-result-card--secondary .calc-result-card__label {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 3px;
}

.calc-result-card--secondary .calc-result-card__value {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-main);
    font-variant-numeric: tabular-nums;
    cursor: pointer;
    display: inline-flex;
    align-items: baseline;
    gap: 4px;
}

.calc-result-card--warning {
    border-color: var(--danger);
    background: var(--bg-surface);
}

.calc-result-card--warning .calc-result-card__label {
    font-size: 0.78rem;
    color: var(--danger);
}

.calc-result-card--warning .calc-result-card__value {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--danger);
    font-variant-numeric: tabular-nums;
    cursor: pointer;
    display: inline-flex;
    align-items: baseline;
    gap: 4px;
}

.calc-result-card__label {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 3px;
}

.calc-result-card__value {
    font-variant-numeric: tabular-nums;
}

.calc-result-row {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

/* ---- copy-hint inside result cards ---- */
.calc-result-card__value .copy-hint {
    font-size: 0.75rem;
    opacity: 0.4;
    transition: opacity var(--transition);
}

.calc-result-card__value:hover .copy-hint {
    opacity: 1;
}

[data-theme="dark"] .calc-result-card--main {
    border-color: var(--primary);
}

[data-theme="dark"] .calc-result-card--warning {
    border-color: var(--danger);
}

/* ---- Result card: sub-text (under main value) ---- */
.calc-result-card__sub {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 6px;
    line-height: 1.4;
}

/* ---- Result card: info variant ---- */
.calc-result-card--info {
    background: var(--bg-surface);
    border: 1px solid var(--glass-border);
}

.calc-result-card--info .calc-result-card__value {
    color: var(--text-secondary);
    font-size: 1.2rem;
}

/* ---- Details: hide default triangle ---- */
.alimony-details > summary {
    list-style: none;
    cursor: pointer;
    font-weight: 600;
    color: var(--text-main);
    padding: 8px 0;
    user-select: none;
}

.alimony-details > summary::-webkit-details-marker {
    display: none;
}

.alimony-details > summary::marker {
    display: none;
}

.alimony-details > summary::before {
    content: "";
    display: inline-block;
    width: 0;
    height: 0;
    border-left: 6px solid var(--text-muted);
    border-top: 4px solid transparent;
    border-bottom: 4px solid transparent;
    margin-right: 8px;
    transition: transform var(--transition);
    vertical-align: middle;
}

.alimony-details[open] > summary::before {
    transform: rotate(90deg);
}

/* ---- Details body: sub-lines ---- */
.alimony-details .calc-details__body p {
    margin: 6px 0;
    line-height: 1.5;
    font-size: 0.9rem;
    color: var(--text-main);
}

.alimony-details .calc-details__body strong {
    font-weight: 600;
    color: var(--text-main);
}

.calc-details__sub {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-left: 16px;
}

/* ---- Details: table-based breakdown ---- */
.alimony-details-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 16px;
    font-size: 0.88rem;
    break-inside: avoid;
}

.alimony-details-table caption {
    text-align: left;
    font-weight: 600;
    color: var(--text-main);
    padding: 8px 0 6px;
    font-size: 0.85rem;
    caption-side: top;
}

.alimony-details-table thead th {
    text-align: left;
    padding: 6px 10px;
    background: var(--bg-surface);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.78rem;
    border-bottom: 1px solid var(--glass-border);
    white-space: nowrap;
}

.alimony-details-table thead th:last-child {
    text-align: right;
}

.alimony-details-table tbody td {
    padding: 5px 10px;
    border-bottom: 1px solid var(--glass-border);
    color: var(--text-main);
    line-height: 1.45;
}

.alimony-details-table tbody td:last-child {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    font-weight: 500;
}

.alimony-details-table__sub td {
    color: var(--text-muted);
    font-size: 0.82rem;
    padding-left: 20px;
}

.alimony-details-table__sub td:last-child {
    font-weight: 400;
}

.alimony-details-table__highlight td {
    background: var(--bg-surface);
    font-weight: 600;
}

.alimony-details-table__highlight td:last-child {
    color: var(--primary);
}

.alimony-details-table__danger td {
    color: var(--danger);
}

.alimony-details-table__danger td:last-child {
    color: var(--danger);
    font-weight: 600;
}

.alimony-details-table__note {
    color: var(--text-muted);
    font-size: 0.8rem;
    font-style: italic;
    text-align: left;
    padding: 6px 10px;
}

[data-theme="dark"] .alimony-details-table thead th {
    background: var(--bg-card);
}

[data-theme="dark"] .alimony-details-table__highlight td {
    background: var(--bg-card);
}

/* ---- Skeleton: min-height prevents layout jumping during AJAX ---- */
.calc-result[aria-busy="true"] {
    min-height: 180px;
    position: relative;
}

.calc-result[aria-busy="true"]::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 28px;
    height: 28px;
    margin: -14px 0 0 -14px;
    border: 3px solid var(--glass-border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: alimony-skeleton-spin 0.7s linear infinite;
}

@keyframes alimony-skeleton-spin {
    to { transform: rotate(360deg); }
}

/* ---- Progress bar: distribution of net income ---- */
.alimony-progress {
    margin: 14px 0 10px;
}

.alimony-progress__track {
    display: flex;
    width: 100%;
    height: 28px;
    border-radius: 8px;
    overflow: hidden;
    background: var(--bg-surface);
    border: 1px solid var(--glass-border);
}

.alimony-progress__seg {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    transition: width 0.3s ease;
    position: relative;
}

.alimony-progress__seg--alimony {
    background: var(--primary);
}

.alimony-progress__seg--remaining {
    background: var(--success);
}

.alimony-progress__seg--debt {
    background: var(--danger);
}

.alimony-progress__seg-label {
    font-size: 0.72rem;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    pointer-events: none;
}

.alimony-progress__legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 8px;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.alimony-progress__legend-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.alimony-progress__legend-item--debt {
    color: var(--danger);
    font-weight: 600;
}

.alimony-progress__swatch {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 3px;
    flex-shrink: 0;
}

.alimony-progress__swatch--alimony {
    background: var(--primary);
}

.alimony-progress__swatch--remaining {
    background: var(--success);
}

.alimony-progress__swatch--debt {
    background: var(--danger);
}

[data-theme="dark"] .alimony-progress__track {
    background: var(--bg-card);
    border-color: var(--border);
}

[data-theme="dark"] .alimony-progress__seg-label {
    color: #fff;
}

/* ---- Mobile: progress bar ---- */
@media (max-width: 768px) {
    .alimony-progress__track {
        height: 22px;
    }

    .alimony-progress__legend {
        gap: 8px;
        font-size: 0.74rem;
    }
}

@media (max-width: 480px) {
    .alimony-progress__track {
        height: 18px;
    }

    .alimony-progress__seg-label {
        display: none;
    }

    .alimony-progress__legend {
        flex-direction: column;
        gap: 4px;
    }
}

/* ---- Print: progress bar hidden (monochrome table in details instead) ---- */
@media print {
    .alimony-progress {
        display: none !important;
    }
}

/* ---- Debt payback schedule ---- */
.alimony-debt-payback {
    margin: 14px 0 10px;
    padding: 12px 14px;
    background: var(--bg-surface);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
}

.alimony-debt-payback__title {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 6px;
    letter-spacing: 0.02em;
}

.alimony-debt-payback__text {
    font-size: 0.9rem;
    line-height: 1.45;
    color: var(--text-main);
    margin-bottom: 10px;
}

.alimony-debt-payback__text strong {
    color: var(--danger);
    font-weight: 600;
}

.alimony-debt-payback__bar {
    display: flex;
    gap: 3px;
    height: 10px;
    margin-bottom: 8px;
}

.alimony-debt-payback__chunk {
    flex: 1 1 0;
    background: var(--danger);
    opacity: 0.65;
    border-radius: 2px;
    transition: opacity 0.3s ease;
}

.alimony-debt-payback__chunk:hover {
    opacity: 1;
}

.alimony-debt-payback__more {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.alimony-debt-payback__disclaimer {
    font-size: 0.74rem;
    color: var(--text-muted);
    line-height: 1.4;
}

[data-theme="dark"] .alimony-debt-payback {
    background: var(--bg-card);
    border-color: var(--border);
}

/* ---- Mobile: debt payback ---- */
@media (max-width: 768px) {
    .alimony-debt-payback {
        padding: 10px 12px;
    }

    .alimony-debt-payback__text {
        font-size: 0.85rem;
    }

    .alimony-debt-payback__disclaimer {
        font-size: 0.7rem;
    }
}

@media (max-width: 480px) {
    .alimony-debt-payback__bar {
        height: 8px;
        gap: 2px;
    }
}

/* ---- Print: debt payback hidden (interactive block) ---- */
@media print {
    .alimony-debt-payback {
        display: none !important;
    }
}

.calc-details__source {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 12px;
    padding-top: 8px;
    border-top: 1px solid var(--glass-border);
    line-height: 1.5;
}

/* ---- Profi form grid: 2 columns on wide screens ---- */
@media (min-width: 1200px) {
    .alimony-profi-fields {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0 16px;
    }
    .alimony-profi-fields .calc-field {
        margin-bottom: 12px;
    }
    /* Full-width elements inside profi grid — calc-field с segmented-toggle--4
       (Статус плательщика, Режим расчёта) занимает всю ширину (2 колонки),
       иначе «Безработный» обрезается в 331px колонке. */
    .alimony-profi-fields .calc-field:has(.segmented-toggle--4),
    .alimony-profi-fields .segmented-toggle {
        grid-column: 1 / -1;
    }
}

/* ---- Mobile ---- */
@media (max-width: 768px) {
    .calc-form__section-title {
        font-size: 0.75rem;
    }

    /* Form hints visible on mobile — critical info for users */
    .calc-field__hint {
        font-size: 0.72rem;
    }

    /* Mode chips: full width */
    .calc-mode-toggle {
        flex-direction: column;
        gap: 6px;
    }

    .calc-mode-chip {
        text-align: center;
        justify-content: center;
        padding: 10px 14px;
        min-height: 44px;
    }

    /* Segmented toggles: stack on mobile */
    .segmented-toggle {
        width: 100%;
        max-width: 100%;
    }

    .segmented-toggle__option {
        padding: 10px 8px;
        font-size: 0.82rem;
        min-height: 44px;
    }

    /* Result cards: stack */
    .calc-result-row {
        flex-direction: column;
        gap: 8px;
    }

    .calc-result-card--main .calc-result-card__value {
        font-size: 1.8rem;
    }

    .calc-result-card__sub {
        font-size: 0.72rem;
    }

    /* Details body: smaller */
    .calc-details__body {
        font-size: 0.88rem;
    }

    .calc-details__sub {
        font-size: 0.8rem;
    }

    /* Details tables: horizontal scroll on mobile */
    .alimony-details-table {
        font-size: 0.82rem;
    }

    .alimony-details-table thead th,
    .alimony-details-table tbody td {
        padding: 4px 6px;
    }

    .alimony-summary {
        padding: 10px 12px;
    }

    .alimony-summary__text {
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    .calc-result-card--main .calc-result-card__value {
        font-size: 1.5rem;
    }

    .segmented-toggle--3 .segmented-toggle__option,
    .segmented-toggle--4 .segmented-toggle__option {
        flex: 1 1 45%;
    }
}

/* ---- Alimony summary (Краткий вывод) ---- */
.alimony-summary {
    margin-top: 1rem;
    padding: 14px 16px;
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius, 8px);
}

.alimony-summary__title {
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
}

.alimony-summary__text {
    font-size: 0.9rem;
    line-height: 1.55;
    color: var(--text-main);
}

.alimony-summary__text p {
    margin-bottom: 0.5rem;
}

.alimony-summary__text p:last-child {
    margin-bottom: 0;
}

/* ---- Dark theme ---- */
[data-theme="dark"] .calc-result-card--info {
    background: var(--bg-card);
    border-color: var(--border);
}

/* ---- Alimony comparison (3 режима бок о бок) ---- */
.alimony-comparison {
    margin: 16px 0;
    padding: 14px 16px;
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius, 8px);
    box-shadow: var(--shadow-sm);
}

.alimony-comparison__header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 8px;
}

.alimony-comparison__title {
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--text-main);
}

.alimony-comparison__hint {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.alimony-comparison__grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.alimony-comparison__card {
    padding: 12px 14px;
    background: var(--bg-surface);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius, 8px);
    transition: border-color 0.15s ease, background 0.15s ease;
}

.alimony-comparison__card--active {
    border-color: rgba(var(--primary-rgb), 0.5);
    background: rgba(var(--primary-rgb), 0.05);
}

.alimony-comparison__mode {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-main);
    margin-bottom: 2px;
}

.alimony-comparison__badge {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 10px;
    background: rgba(var(--primary-rgb), 0.15);
    color: var(--primary);
    vertical-align: middle;
    margin-left: 4px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.alimony-comparison__sub {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 8px;
    min-height: 1em;
}

.alimony-comparison__value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
    font-variant-numeric: tabular-nums;
    cursor: pointer;
    line-height: 1.2;
}

.alimony-comparison__value .currency {
    font-size: 0.7em;
    color: var(--text-muted);
    margin-left: 2px;
    font-weight: 500;
}

.alimony-comparison__arrears {
    margin-top: 6px;
    font-size: 0.8rem;
    color: var(--danger);
    font-variant-numeric: tabular-nums;
    cursor: pointer;
}

.alimony-comparison__remaining {
    margin-top: 4px;
    font-size: 0.8rem;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

/* Hover: slight bg for non-active cards */
.alimony-comparison__card:not(.alimony-comparison__card--active):hover {
    background: var(--bg-surface-hover);
}

/* ---- Mobile: 1 column stack ---- */
@media (max-width: 768px) {
    .alimony-comparison {
        padding: 10px 12px;
    }

    .alimony-comparison__grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .alimony-comparison__title {
        font-size: 0.95rem;
    }

    .alimony-comparison__value {
        font-size: 1.1rem;
    }

    .alimony-comparison__sub,
    .alimony-comparison__arrears,
    .alimony-comparison__remaining {
        font-size: 0.78rem;
    }
}

/* ---- Print: comparison hidden (interactive block) ---- */
@media print {
    .alimony-comparison {
        display: none !important;
    }
}

/* ---- Alimony events calendar (Календарь событий) ---- */
.alimony-events {
    margin: 16px 0;
    padding: 14px 16px;
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius, 8px);
    box-shadow: var(--shadow-sm);
}

.alimony-events__header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 8px;
}

.alimony-events__title {
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--text-main);
}

.alimony-events__hint {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.alimony-events__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 12px;
}

.alimony-events__card {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    background: var(--bg-surface);
    border: 1px solid var(--glass-border);
    border-left: 4px solid var(--info);
    border-radius: var(--radius, 8px);
    transition: border-color 0.15s ease, background 0.15s ease;
}

.alimony-events__card--urgent {
    border-left-color: var(--warning);
}

.alimony-events__card--info {
    border-left-color: var(--info);
}

.alimony-events__card:hover {
    background: var(--bg-surface-hover);
}

.alimony-events__icon {
    font-size: 1.3rem;
    line-height: 1;
    flex-shrink: 0;
    padding-top: 2px;
}

.alimony-events__body {
    flex: 1 1 auto;
    min-width: 0;
}

.alimony-events__name {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-main);
    margin-bottom: 4px;
}

.alimony-events__text {
    font-size: 0.85rem;
    line-height: 1.45;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.alimony-events__ref {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-style: italic;
}

.alimony-events__badge {
    flex-shrink: 0;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 10px;
    background: rgba(var(--warning-rgb), 0.15);
    color: var(--warning);
    white-space: nowrap;
    line-height: 1.4;
}

.alimony-events__badge--info {
    background: rgba(var(--info-rgb), 0.15);
    color: var(--info);
}

.alimony-events__card--info .alimony-events__badge {
    background: rgba(var(--info-rgb), 0.15);
    color: var(--info);
}

[data-theme="dark"] .alimony-events__badge {
    background: rgba(var(--warning-rgb), 0.18);
}

[data-theme="dark"] .alimony-events__badge--info,
[data-theme="dark"] .alimony-events__card--info .alimony-events__badge {
    background: rgba(var(--info-rgb), 0.18);
}

[data-theme="dark"] .alimony-events {
    background: var(--bg-card);
    border-color: var(--border);
}

/* ---- Mobile: events calendar ---- */
@media (max-width: 768px) {
    .alimony-events {
        padding: 10px 12px;
    }

    .alimony-events__grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .alimony-events__title {
        font-size: 0.95rem;
    }

    .alimony-events__name {
        font-size: 0.9rem;
    }

    .alimony-events__text {
        font-size: 0.8rem;
    }

    .alimony-events__icon {
        font-size: 1.1rem;
    }
}

@media (max-width: 480px) {
    .alimony-events__card {
        padding: 10px 12px;
        gap: 8px;
    }

    .alimony-events__badge {
        font-size: 0.7rem;
        padding: 2px 6px;
    }
}

/* ---- Print: events hidden (interactive block) ---- */
@media print {
    .alimony-events {
        display: none !important;
    }
}

/* ---- Кнопка «Обновить среднюю ЗП» + badge «Росстат, [месяц год]» ---- */
/* Эталон: .inflation-display__refresh в calc_inflation.css:33-59. */
.calc-field__label-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.calc-field__label-row .calc-field__label {
    margin-bottom: 0;
}

.avg-salary-refresh {
    flex: 0 0 auto;
    background: var(--bg-surface);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 5px;
    cursor: pointer;
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease, color 0.15s ease, transform 0.2s ease;
}

.avg-salary-refresh:hover {
    background: var(--bg-surface-hover);
    color: var(--primary);
    transform: rotate(180deg);
}

.avg-salary-refresh:disabled,
.avg-salary-refresh--loading {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.avg-salary-refresh--loading svg {
    animation: avg-salary-refresh-spin 1s linear infinite;
}

@keyframes avg-salary-refresh-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.avg-salary-badge {
    display: inline-block;
    margin-top: 6px;
    font-size: 0.72rem;
    color: var(--text-muted);
    background: var(--bg-surface);
    border: 1px solid var(--glass-border);
    border-radius: 6px;
    padding: 2px 8px;
}

.avg-salary-badge--stale {
    color: var(--warning);
    border-color: var(--warning);
}

/* Mobile: кнопка 44×44 (touch target), badge full-width */
@media (max-width: 768px) {
    .avg-salary-refresh {
        min-width: 36px;
        min-height: 36px;
        padding: 7px;
    }

    .avg-salary-badge {
        font-size: 0.7rem;
    }
}

/* Print: badge виден (носитель данных важен для бумажного расчёта) */
@media print {
    .avg-salary-refresh {
        display: none !important;
    }

    .avg-salary-badge {
        display: inline-block !important;
        border: none;
        background: none;
        padding: 0;
        font-size: 0.7rem;
    }
}

/* ── Пояснение про пристава под кнопкой «Скачать DOCX» ── */
.calc-docx-notice {
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.4;
    margin-top: 8px;
    max-width: 400px;
}

@media (max-width: 768px) {
    .calc-docx-notice {
        font-size: 0.72rem;
    }
}

@media print {
    .calc-docx-notice {
        display: none;
    }
}

/* ---- Print: single mode — print-only таблица + скрытие карточек ---- */
@media print {
    .calc-result-card--main,
    .calc-result-card--secondary,
    .calc-result-card--warning,
    .calc-result-card--info,
    .calc-result-row {
        display: none !important;
    }

    .alimony-print-result {
        margin: 8pt 0 12pt;
        break-inside: avoid;
    }

    .alimony-print-table {
        width: 100%;
        border-collapse: collapse;
        font-size: 10pt;
    }

    .alimony-print-table td {
        padding: 4pt 6pt;
        border: 0.5pt solid #999;
    }

    .alimony-print-table__main td {
        border: 1.5pt solid #000;
        padding: 8pt 6pt;
        text-align: center;
        background: #f0f0f0;
    }

    .alimony-print-table__main-label {
        font-size: 9pt;
        color: #444;
        text-transform: uppercase;
        letter-spacing: 0.5pt;
        margin-bottom: 2pt;
    }

    .alimony-print-table__main-value {
        font-size: 18pt;
        font-weight: 700;
        color: #000;
    }

    .alimony-print-table__warning td {
        font-weight: 700;
        border-left: 3pt solid #000;
    }

    .alimony-print-table__note td {
        font-size: 8pt;
        color: #555;
        font-style: italic;
        border: none;
        padding-top: 6pt;
    }
}

/* ---- Alimony period grid (доход по месяцам, форма) ---- */
.alimony-period-toggle {
    margin-bottom: 12px;
}

.alimony-period-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin: 12px 0;
}

.alimony-period-grid__item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.alimony-period-grid__label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.alimony-period-grid__input {
    width: 100%;
}

.alimony-period-grid__fill {
    margin-top: 8px;
}

/* ---- Alimony period result (таблица результата за период) ---- */
.alimony-period-result {
    margin: 16px 0;
}

.alimony-period-result__title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-main);
}

.alimony-period-result__table-wrap {
    overflow-x: auto;
}

.alimony-period-result__table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.alimony-period-result__table th,
.alimony-period-result__table td {
    padding: 8px 12px;
    text-align: right;
    border-bottom: 1px solid var(--border);
}

.alimony-period-result__table th {
    font-weight: 600;
    color: var(--text-muted);
    background: var(--bg-card);
}

.alimony-period-result__table td:first-child,
.alimony-period-result__table th:first-child {
    text-align: left;
}

.alimony-period-result__totals {
    font-weight: 600;
    background: var(--bg-card);
}

.alimony-period-result__totals td {
    border-top: 2px solid var(--primary);
}

.alimony-period-result__arrears {
    margin-top: 12px;
    padding: 10px 14px;
    background: var(--danger-bg, rgba(220, 53, 69, 0.08));
    border-left: 4px solid var(--danger);
    border-radius: 4px;
    color: var(--text-main);
}

.alimony-period-result__disclaimer {
    margin-top: 12px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.alimony-period-result__export {
    margin-top: 14px;
}

/* ---- Mobile: period grid + result ---- */
@media (max-width: 768px) {
    .alimony-period-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 6px;
    }

    .alimony-period-grid__label {
        font-size: 0.7rem;
    }

    .alimony-period-result__title {
        font-size: 1rem;
    }

    .alimony-period-result__table {
        font-size: 0.82rem;
    }

    .alimony-period-result__table th,
    .alimony-period-result__table td {
        padding: 6px 8px;
    }

    .alimony-period-result__arrears {
        font-size: 0.85rem;
        padding: 8px 10px;
    }

    .alimony-period-result__disclaimer {
        font-size: 0.72rem;
    }
}

@media (max-width: 480px) {
    .alimony-period-grid {
        grid-template-columns: 1fr;
    }

    .alimony-period-result__table {
        font-size: 0.75rem;
    }

    .alimony-period-result__table th,
    .alimony-period-result__table td {
        padding: 5px 6px;
        white-space: nowrap;
    }
}

/* ---- Print: period ---- */
@media print {
    .alimony-period-toggle,
    .alimony-period-grid__fill,
    .alimony-period-result__export,
    .alimony-period-result__disclaimer {
        display: none !important;
    }

    .alimony-period-result__title {
        display: none !important;
    }

    .alimony-period-result__table-wrap {
        overflow: visible;
    }

    .alimony-period-result__table {
        font-size: 10pt;
        border-collapse: collapse;
    }

    .alimony-period-result__table th,
    .alimony-period-result__table td {
        border: 0.5pt solid #999;
        padding: 4pt 6pt;
    }

    .alimony-period-result__table tr {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .alimony-period-result__table thead {
        display: table-header-group;
    }

    .alimony-period-result__table th {
        background: #e0e0e0 !important;
        color: #000000 !important;
        font-weight: 700;
        border-bottom: 2pt solid #000;
    }

    .alimony-period-result__totals td {
        border-top: 2pt solid #000;
        background: #f5f5f5 !important;
        font-weight: 700;
        color: #000000 !important;
    }

    .alimony-period-result__arrears {
        background: transparent !important;
        border-left: 4pt solid #000;
        color: #000000 !important;
        font-size: 9pt;
        break-inside: avoid;
    }

    .alimony-period-result__source {
        display: block !important;
        font-size: 8pt;
        color: #666 !important;
        border-top: 0.5pt solid #ccc;
        margin-top: 10pt;
        padding-top: 6pt;
        break-inside: avoid;
    }
}
