/* Калькулятор материнского капитала на макете редизайна. Разметка, id и подписи прежние, скрипт
   public/js/finansovie/matkapital.js не менялся. Файл грузится раньше rd.css, поэтому
   селекторы начинаются с .rd #mk-calc.
   redesign.css сбрасывает всем input оформление (all: unset) — чекбокс, радио, поля и select
   нарисованы здесь заново. Скрипт ставит блокам style.display = "" или "none", поэтому
   раскладка показанных блоков задана здесь. Основа — rd-edinoe-posobie.css. */

.rd #mk-calc .calculator { display: flex; flex-direction: column; gap: 24px; margin: 0; }

/* шаги: точки в ряд, между ними линия; полосу прогресса макет не рисует */
.rd #mk-calc .mk-progress { margin: 0; }
.rd #mk-calc .mk-progress-track { display: none; }
.rd #mk-calc .mk-dots { display: flex; align-items: center; gap: 12px; margin: 0; }
.rd #mk-calc .mk-dot { display: flex; align-items: center; gap: 8px; min-width: 0; margin: 0; padding: 0; border: 0; background: none; font: 400 13px/1.2 var(--f-ui); color: var(--mute); white-space: nowrap; cursor: pointer; }
.rd #mk-calc .mk-dot:not(:first-child) { flex: 1 1 0; }
.rd #mk-calc .mk-dot:not(:first-child)::before { content: ""; flex: 1 1 auto; min-width: 12px; height: 1px; margin-right: 4px; background: var(--line); }
.rd #mk-calc .mk-dot span { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 26px; width: 26px; height: 26px; border-radius: 50%; background: var(--pill); font: 600 12px/1 var(--f-ui); color: var(--mute); }
.rd #mk-calc .mk-dot:hover { color: var(--ink); }
.rd #mk-calc .mk-dot.cur { font-weight: 500; color: var(--ink); }
.rd #mk-calc .mk-dot.cur span { background: var(--ink); color: #fff; }
.rd #mk-calc .mk-dot.done { color: var(--ink); }
.rd #mk-calc .mk-dot.done span { background: var(--ink) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / 14px no-repeat; color: transparent; }
.rd #mk-calc .mk-dot:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 8px; }

.rd #mk-calc .mk-step { display: none; margin: 0; }
.rd #mk-calc .mk-step.active { display: flex; flex-direction: column; gap: 14px; }
.rd #mk-calc .mk-step > .label-text { display: block; margin: 0; font: 600 18px/1.3 var(--f-ui); color: var(--ink); }

/* дети: строка «дата рождения + крестик», скрипт добавляет строки сам */
.rd #mk-calc #mk-children { display: flex; flex-direction: column; gap: 12px; margin: 0; }
.rd #mk-calc #mk-children:empty { display: none; }
.rd #mk-calc .mk-child { display: flex; align-items: flex-end; gap: 10px; margin: 0; }
.rd #mk-calc .mk-child .form-group { flex: 0 1 360px; max-width: none; }
.rd #mk-calc .mk-child-del { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 48px; width: 48px; height: 48px; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 14px; background: var(--tile); font: 400 22px/1 var(--f-ui); color: var(--bad); cursor: pointer; transition: background .15s, border-color .15s; }
.rd #mk-calc .mk-child-del:hover { border-color: var(--bad); background: var(--bad-soft); }
.rd #mk-calc .mk-child-del:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.rd #mk-calc .mk-add-child { align-self: flex-start; display: inline-flex; align-items: center; height: 38px; margin: 0; padding: 0 16px; border: 0; border-radius: 999px; background: var(--pill); font: 500 13px/1.2 var(--f-ui); color: var(--ink); white-space: nowrap; cursor: pointer; }
.rd #mk-calc .mk-add-child:hover { background: var(--line); }
.rd #mk-calc .mk-add-child:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* цели: плитки в две колонки */
.rd #mk-calc .mk-radio-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 0; }
.rd #mk-calc .mk-radio { display: flex; align-items: flex-start; gap: 12px; min-width: 0; box-sizing: border-box; margin: 0; padding: 16px 18px; border: 1px solid var(--line); border-radius: 16px; background: var(--tile); cursor: pointer; transition: border-color .15s; }
.rd #mk-calc .mk-radio:hover { border-color: var(--accent-mid); }
.rd #mk-calc .mk-radio:has(input:checked) { border-color: var(--accent); }
.rd #mk-calc .mk-radio > span { display: flex; flex-direction: column; gap: 4px; min-width: 0; font: 500 15px/1.35 var(--f-ui); color: var(--ink); }
.rd #mk-calc .mk-radio small { display: block; margin: 0; font: 400 13px/1.4 var(--f-ui); color: var(--mute); opacity: 1; }

/* радио и галочки: у плиток целей и режима ипотеки кружок, у «ещё не использовали» — квадрат */
.rd #mk-calc .mk-radio input,
.rd #mk-calc .mk-check input { display: block; -webkit-appearance: none; appearance: none; box-sizing: border-box; flex: 0 0 18px; width: 18px; height: 18px; min-width: 0; margin: 1px 0 0; padding: 0; border: 1.5px solid var(--mute); border-radius: 50%; background: var(--tile); cursor: pointer; }
.rd #mk-calc .mk-radio input:checked,
.rd #mk-calc .mk-check input[type="radio"]:checked { border-color: var(--accent); background: radial-gradient(circle, #fff 0 3.5px, var(--accent) 4px); }
.rd #mk-calc .mk-check input[type="checkbox"] { border-radius: 5px; }
.rd #mk-calc .mk-check input[type="checkbox"]:checked { border-color: var(--accent); background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / 13px no-repeat; }
.rd #mk-calc .mk-radio input:focus-visible,
.rd #mk-calc .mk-check input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.rd #mk-calc .mk-check { display: flex; align-items: flex-start; gap: 10px; margin: 0; padding: 13px 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--tile); font: 400 14px/1.45 var(--f-ui); color: var(--ink); cursor: pointer; transition: border-color .15s; }
.rd #mk-calc .mk-check:hover { border-color: var(--accent-mid); }
.rd #mk-calc .mk-check:has(input:checked) { border-color: var(--accent); }

/* поля */
.rd #mk-calc .form-group { display: flex; flex-direction: column; gap: 8px; min-width: 0; max-width: calc(50% - 8px); margin: 0; }
.rd #mk-calc .form-group label { margin: 0; font: 400 11px/1.3 var(--f-mono); letter-spacing: 1px; text-transform: uppercase; color: var(--mute); }
.rd #mk-calc .form-group input { display: block; -webkit-appearance: none; appearance: none; -moz-appearance: textfield; box-sizing: border-box; width: 100%; height: 48px; margin: 0; padding: 0 16px; background: var(--tile); border: 1px solid var(--line); border-radius: 14px; box-shadow: none; outline: none; font: 500 16px/46px var(--f-ui); color: var(--ink); }
.rd #mk-calc .form-group input::-webkit-outer-spin-button,
.rd #mk-calc .form-group input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.rd #mk-calc .form-group input::-webkit-date-and-time-value { text-align: left; }
.rd #mk-calc .form-group input::-webkit-calendar-picker-indicator { opacity: .6; cursor: pointer; }
.rd #mk-calc .form-group input:focus { border-color: var(--accent); }
.rd #mk-calc .form-group select { display: block; -webkit-appearance: none; appearance: none; box-sizing: border-box; width: 100%; height: 48px; margin: 0; padding: 0 40px 0 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border: 1px solid var(--line); border-radius: 14px; box-shadow: none; outline: none; background: var(--tile) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236B7075' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") right 14px center / 16px no-repeat; font: 500 16px/46px var(--f-ui); color: var(--ink); cursor: pointer; }
.rd #mk-calc .form-group select:focus { border-color: var(--accent); }
.rd #mk-calc .mk-hint { display: block; margin: 0; font: 400 13px/1.5 var(--f-ui); color: var(--mute); opacity: 1; }
.rd #mk-calc .mk-hint:empty { display: none; }

/* ипотека: режим двумя плитками, пары полей в две колонки */
.rd #mk-calc #mk-price-wrap { display: flex; flex-direction: column; gap: 14px; margin: 8px 0 0; }
.rd #mk-calc #mk-mode-wrap,
.rd #mk-calc #mk-down-fields,
.rd #mk-calc #mk-loan-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; margin: 0; }
.rd #mk-calc #mk-mode-wrap { gap: 12px; }
.rd #mk-calc #mk-down-fields .form-group,
.rd #mk-calc #mk-loan-fields .form-group { max-width: none; }
.rd #mk-calc #mk-repay-fields { display: flex; flex-direction: column; margin: 0; }

/* навигация по шагам */
.rd #mk-calc .mk-nav { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0; }
.rd #mk-calc #mk-back { display: inline-flex; align-items: center; justify-content: center; height: 44px; margin: 0; padding: 0 24px; border: 0; border-radius: 999px; background: var(--pill); font: 400 13px/1.2 var(--f-ui); color: var(--ink); white-space: nowrap; cursor: pointer; }
.rd #mk-calc #mk-back:disabled,
.rd #mk-calc #mk-next:disabled { opacity: .5; cursor: default; }
.rd #mk-calc .mk-step-label { margin: 0; font: 400 11px/1.3 var(--f-mono); letter-spacing: 1px; color: var(--mute); text-align: center; }
.rd #mk-calc #mk-next { display: inline-flex; align-items: center; justify-content: center; height: 46px; margin: 0; padding: 0 28px; border: 0; border-radius: 999px; background: var(--ink); font: 500 15px/1.2 var(--f-ui); color: #fff; white-space: nowrap; cursor: pointer; }
.rd #mk-calc #mk-back:not(:disabled):hover,
.rd #mk-calc #mk-next:not(:disabled):hover { opacity: .85; }

/* нет права на капитал; размер шрифта 12px задаёт общее правило сайта для *-warn */
.rd #mk-calc .mk-warn { display: block; margin: 0; padding: 14px 16px; border-radius: 14px; background: #FBF0E0; line-height: 1.5; color: #92400E; }
.rd #mk-calc .mk-warn:empty { display: none; }

/* результат: капитал крупно, строки расчёта, плашки срока, доли жилья и ипотеки */
.rd #mk-calc #mk-result { display: flex; flex-direction: column; gap: 0; margin: 0; padding: 28px; border-radius: 20px; background: var(--tile); }
.rd #mk-calc #mk-result > .label-text { display: block; margin: 0 0 12px; font: 400 11px/1.3 var(--f-mono); letter-spacing: 1px; text-transform: uppercase; color: var(--mute); }
.rd #mk-calc .tax-result { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 0; padding: 14px 0; border-bottom: 1px solid var(--line); }
.rd #mk-calc .tax-result > span { min-width: 0; font: 400 15px/1.35 var(--f-ui); color: var(--mute); }
.rd #mk-calc .tax-result .amount-group { flex: 0 0 auto; max-width: 60%; margin: 0; text-align: right; }
.rd #mk-calc .tax-result .amount-group span { font: 600 17px/1.3 var(--f-ui); letter-spacing: -.2px; color: var(--ink); }
.rd #mk-calc .tax-result.mk-main { flex-direction: column; align-items: flex-start; gap: 8px; padding: 0 0 18px; }
.rd #mk-calc .mk-main > span { font-weight: 600; color: var(--ink); }
.rd #mk-calc .mk-main .amount-group { max-width: none; text-align: left; }
.rd #mk-calc .mk-main .amount-group span { font-size: 34px; line-height: 1.1; letter-spacing: -1px; }

.rd #mk-calc .mk-when { display: block; margin: 20px 0 0; padding: 14px 16px; border-radius: 14px; background: var(--card); font: 400 14px/1.5 var(--f-ui); color: var(--ink); }
.rd #mk-calc .mk-when:empty { display: none; }
.rd #mk-calc .mk-when.ok { background: #E3F2EA; }
.rd #mk-calc .mk-when.wait { background: #FBF0E0; color: #92400E; }
.rd #mk-calc .mk-when b { font-weight: 600; }

.rd #mk-calc .mk-housing { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 16px 0 0; padding: 0; border: 0; }
.rd #mk-calc .mk-housing > div { display: flex; flex-direction: column; gap: 6px; min-width: 0; padding: 18px 20px; border-radius: 16px; background: var(--card); }
.rd #mk-calc .mk-housing span { font: 400 14px/1.4 var(--f-ui); color: var(--mute); }
.rd #mk-calc .mk-housing b { font: 600 20px/1.25 var(--f-ui); letter-spacing: -.3px; color: var(--ink); }

.rd #mk-calc .mk-mort { display: flex; flex-direction: column; gap: 0; margin: 24px 0 0; }
.rd #mk-calc .mk-mort > .label-text { display: block; margin: 0 0 4px; font: 600 16px/1.35 var(--f-ui); color: var(--ink); }
.rd #mk-calc .mk-mort .mk-when { margin-top: 16px; }

.rd #mk-calc .mk-how { margin: 24px 0 0; padding: 14px 20px; border: 0; border-radius: 14px; background: var(--card); }
.rd #mk-calc .mk-how summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0; list-style: none; font: 500 14px/1.4 var(--f-ui); color: var(--ink); cursor: pointer; }
.rd #mk-calc .mk-how summary::-webkit-details-marker { display: none; }
.rd #mk-calc .mk-how summary::before { content: none; }
.rd #mk-calc .mk-how summary::after { content: ""; flex: 0 0 18px; width: 18px; height: 18px; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230D0D0D' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") center / 18px no-repeat; transition: transform .15s; }
.rd #mk-calc .mk-how[open] summary::after { transform: rotate(180deg); }
.rd #mk-calc .mk-how ol { margin: 12px 0 0; padding: 0 0 0 22px; list-style: decimal outside; font: 400 14px/1.55 var(--f-ui); color: var(--ink); }
.rd #mk-calc .mk-how li::marker { font-family: var(--f-mono); font-size: 12px; color: var(--mute); }
.rd #mk-calc .mk-how li { margin: 0; padding: 0; border: 0; }
.rd #mk-calc .mk-how li + li { margin-top: 8px; }
.rd #mk-calc .mk-how li::before { content: none; }
.rd #mk-calc .mk-how-h { display: block; font-weight: 600; }
.rd #mk-calc .mk-how-b { display: block; font-variant-numeric: tabular-nums; }
.rd #mk-calc .mk-how b { font-weight: 600; }

@media (max-width: 1100px) {
    .rd #mk-calc .mk-radio-list { grid-template-columns: minmax(0, 1fr); gap: 10px; }
}

@media (max-width: 639px) {
    .rd #mk-calc .calculator { gap: 20px; }
    .rd #mk-calc .mk-dots { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; }
    .rd #mk-calc .mk-dot { flex-direction: column; gap: 6px; font-size: 12px; white-space: normal; text-align: center; }
    .rd #mk-calc .mk-dot:not(:first-child)::before { display: none; }
    .rd #mk-calc .mk-dot.cur { font-weight: 600; }
    .rd #mk-calc .mk-step > .label-text { font-size: 17px; }
    .rd #mk-calc .mk-radio { padding: 14px 16px; }
    .rd #mk-calc .form-group { max-width: none; }
    .rd #mk-calc .mk-child .form-group { flex: 1 1 auto; }
    .rd #mk-calc #mk-mode-wrap,
    .rd #mk-calc #mk-down-fields,
    .rd #mk-calc #mk-loan-fields { grid-template-columns: minmax(0, 1fr); gap: 12px; }
    .rd #mk-calc #mk-mode-wrap { gap: 8px; }
    .rd #mk-calc #mk-back { height: 42px; padding: 0 18px; font-size: 14px; }
    .rd #mk-calc #mk-next { height: 44px; padding: 0 22px; font-size: 14px; }
    /* на последнем шаге кнопка «Показать результат» длинная: номер шага прячем, как на старой странице */
    .rd #mk-calc.mk-last .mk-step-label { display: none; }
    .rd #mk-calc #mk-result { padding: 18px 16px; }
    .rd #mk-calc .tax-result { flex-direction: column; align-items: flex-start; gap: 4px; padding: 12px 0; }
    .rd #mk-calc .tax-result .amount-group { max-width: none; text-align: left; }
    .rd #mk-calc .tax-result > span { font-size: 14px; }
    .rd #mk-calc .tax-result .amount-group span { font-size: 15px; }
    .rd #mk-calc .tax-result.mk-main { padding: 0 0 16px; }
    .rd #mk-calc .mk-main > span { font-size: 15px; }
    .rd #mk-calc .mk-main .amount-group span { font-size: 28px; letter-spacing: -.5px; }
    .rd #mk-calc .mk-when { font-size: 13px; }
    .rd #mk-calc .mk-housing { grid-template-columns: minmax(0, 1fr); gap: 8px; }
    .rd #mk-calc .mk-housing > div { padding: 14px 16px; }
    .rd #mk-calc .mk-housing b { font-size: 18px; }
    .rd #mk-calc .mk-mort > .label-text { font-size: 15px; }
    .rd #mk-calc .mk-how { padding: 14px 16px; }
    .rd #mk-calc .mk-how summary::after { flex-basis: 16px; width: 16px; height: 16px; background-size: 16px; }
}

/* таблицы статьи: суммы и сроки не переносятся по пробелу перед ₽ */
.rd .rd-article__body .mk-table td:not(:first-child) { white-space: nowrap; }

/* источники и дисклеймер в боковой колонке статьи */
.rd .rda-src h2.rd-label { margin: 0; padding: 0; border: 0; font: 400 11px/1.4 var(--f-mono); letter-spacing: 1px; text-transform: uppercase; color: var(--mute); scroll-margin-top: 16px; }
.rd .rda-src__list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.rd .rda-src__list li { display: flex; flex-direction: column; gap: 2px; margin: 0; padding: 12px 0; border-bottom: 1px solid var(--line); }
.rd .rda-src__list li:last-child { padding-bottom: 0; border-bottom: 0; }
.rd .rda-src__list li::before { display: none; }
.rd .rda-src__list b { font: 600 14px/1.35 var(--f-ui); color: var(--ink); }
.rd .rda-src__list span { font: 400 13px/1.45 var(--f-ui); color: var(--mute); }
.rd .rda-src__list a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--accent-mid); text-underline-offset: 2px; }
.rd .rd-article__aside .ymyl-disclaimer { margin: 0; padding: 24px; border-radius: 22px; }
.rd .rd-article__aside .ymyl-disclaimer strong { display: block; margin-bottom: 10px; font: 400 11px/1.4 var(--f-mono); letter-spacing: 1px; text-transform: uppercase; color: var(--ink); }
@media (max-width: 639px) {
    .rd .rd-article__aside .ymyl-disclaimer { padding: 20px; border-radius: 20px; }
}
