/* Калькулятор госпошлины в суд на макете редизайна. Разметка, id и подписи прежние,
   скрипты public/js/finansovie/kalkulyator-gosposhliny.js и custom-select.js не менялись.
   Файл грузится раньше rd.css, поэтому селекторы начинаются с .rd #gp-calc.
   Скрипт показывает блоки через style.display: #gpCenaWrap — "flex", #gpVozvratWrap,
   #gpResult, #gpSmeta и #gpError — "block", остальные — "" (тогда действует этот файл).
   Поэтому внутри блоков с "block" отступы заданы через margin, а не через gap. */

.rd #gp-calc .calculator { margin: 0; padding: 0; border: 0; background: none; box-shadow: none; }
.rd #gp-calc .calculator__form { display: flex; flex-direction: column; gap: 16px; margin: 0; }

/* подписи полей */
.rd #gp-calc .custom-select > .label-text,
.rd #gp-calc .form-group label { display: block; margin: 0 0 8px; font: 400 11px/1.3 var(--f-mono); letter-spacing: 1px; text-transform: uppercase; color: var(--mute); }

/* выпадающие списки на div: длинное значение переносится, а не режется */
.rd #gp-calc .custom-select { position: relative; width: auto; height: auto; min-height: 0; margin: 0; padding: 0; border: 0; background: none; }
.rd #gp-calc .custom-select__selected { box-sizing: border-box; position: relative; display: flex; align-items: center; min-height: 52px; height: auto; margin: 0; padding: 14px 44px 14px 16px; background: var(--tile); border: 1px solid var(--line); border-radius: 14px; font: 500 15px/1.35 var(--f-ui); color: var(--ink); cursor: pointer; transition: border-color .15s; }
.rd #gp-calc .custom-select__selected:hover { border-color: var(--accent-mid); }
.rd #gp-calc .custom-select.open .custom-select__selected { border-color: var(--accent); }
.rd #gp-calc .custom-select__selected::after { content: ""; position: absolute; right: 18px; top: 50%; width: 8px; height: 8px; margin-top: -6px; border: solid var(--ink); border-width: 0 1.5px 1.5px 0; transform: rotate(45deg); background: none; transition: transform .15s; }
.rd #gp-calc .custom-select.open .custom-select__selected::after { margin-top: -2px; transform: rotate(-135deg); }
.rd #gp-calc .custom-select__options { display: none; position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 20; max-height: 360px; overflow-y: auto; box-sizing: border-box; padding: 6px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 12px 32px rgba(13, 13, 13, .12); }
.rd #gp-calc .custom-select.open .custom-select__options { display: block; }
.rd #gp-calc .custom-select__option { padding: 10px 12px; border-radius: 10px; font: 400 14px/1.35 var(--f-ui); color: var(--ink); cursor: pointer; background: none; }
.rd #gp-calc .custom-select__option:hover,
.rd #gp-calc .custom-select__option.selected { background: var(--accent-soft); }

/* пояснение к виду требования */
.rd #gp-calc .gp-hint { margin: -6px 0 0; padding: 12px 14px; border-radius: 12px; background: var(--accent-soft); font: 400 13px/1.5 var(--f-ui); color: var(--ink); }
.rd #gp-calc .gp-hint a { color: var(--accent); }

/* поля ввода */
.rd #gp-calc .form-group { position: static; min-width: 0; width: auto; margin: 0; }
.rd #gp-calc .calculator__input { display: block; -webkit-appearance: none; appearance: none; 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); text-align: left; }
.rd #gp-calc .calculator__input::placeholder { position: static; font: 400 16px/46px var(--f-ui); color: var(--mute); opacity: 1; }
.rd #gp-calc .calculator__input:focus { border-color: var(--accent); }

/* помощник «цена иска» и раскрывашка возврата */
.rd #gp-calc .gp-mini-toggle { align-self: flex-start; width: auto; margin: 0; padding: 0; border: 0; background: none; font: 500 14px/1.4 var(--f-ui); color: var(--accent); text-align: left; text-decoration: none; cursor: pointer; }
.rd #gp-calc .gp-mini-toggle:hover { text-decoration: underline; text-underline-offset: 3px; }
.rd #gp-calc .gp-mini-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.rd #gp-calc .gp-mini { flex-direction: column; gap: 14px; margin: 0; padding: 20px; border: 0; border-radius: 16px; background: var(--tile); }
.rd #gp-calc .gp-mini .calculator__input { background: #fff; }
.rd #gp-calc #gpCenaWrap { display: none; }
.rd #gp-calc #gpCenaWrap .form-group:nth-child(-n+4) { margin: 0; }
.rd #gp-calc .gp-cena-sum { margin: 0; padding: 14px 0 0; border-top: 1px solid var(--line); font: 400 14px/1.4 var(--f-ui); color: var(--mute); }
.rd #gp-calc .gp-cena-sum b { font-weight: 600; font-size: 18px; color: var(--ink); }

/* льгота */
.rd #gp-calc .gp-check { display: flex; align-items: flex-start; gap: 10px; margin: 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--tile); font: 400 14px/1.45 var(--f-ui); color: var(--ink); cursor: pointer; transition: border-color .15s; }
.rd #gp-calc .gp-check:has(input:checked) { border-color: var(--ink); }
.rd #gp-calc .gp-check input { -webkit-appearance: none; appearance: none; display: block; flex: 0 0 18px; box-sizing: border-box; width: 18px; height: 18px; min-width: 18px; margin: 1px 0 0; padding: 0; border: 1.5px solid var(--mute); border-radius: 5px; background: #fff no-repeat center / 12px; cursor: pointer; }
.rd #gp-calc .gp-check input:checked { border-color: var(--ink); background-color: var(--ink); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E"); }
.rd #gp-calc .gp-check input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ошибка */
.rd #gp-calc .calc-error { display: none; margin: 0; padding: 12px 16px; border-radius: 12px; background: var(--bad-soft); color: var(--bad); font: 500 14px/1.45 var(--f-ui); }

/* кнопки */
.rd #gp-calc .btn-wrapper { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 0; padding: 0; }
.rd #gp-calc .btn-wrapper button { display: inline-flex; align-items: center; justify-content: center; flex: none; width: auto; max-width: none; height: 46px; margin: 0; padding: 0 24px; border: 0; border-radius: 999px; background: var(--pill); font: 500 14px/1.2 var(--f-ui); color: var(--ink); white-space: nowrap; cursor: pointer; transition: opacity .15s; }
.rd #gp-calc .btn-wrapper button.black { padding: 0 28px; background: var(--ink); color: #fff; }
.rd #gp-calc .btn-wrapper button:hover { opacity: .85; }
.rd #gp-calc .btn-wrapper button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* результат */
.rd #gp-calc .calculator__result { box-sizing: border-box; margin: 0; padding: 28px; border: 0; border-radius: 20px; background: var(--tile); }
.rd #gp-calc .calculator__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 #gp-calc .res-wrapper { margin: 0; }
.rd #gp-calc #gpResMain { margin: 0; font: 400 15px/1.4 var(--f-ui); color: var(--mute); }
.rd #gp-calc #gpResMain b { display: block; margin: 6px 0 0; font: 600 44px/1.1 var(--f-ui); letter-spacing: -.5px; color: var(--ink); font-variant-numeric: tabular-nums; }
.rd #gp-calc #gpResExtra { margin: 16px 0 0; }
.rd #gp-calc #gpResExtra:empty { display: none; }
.rd #gp-calc #gpResExtra .gp-line { margin: 0; padding: 10px 0; border-top: 1px solid var(--line); font: 400 14px/1.5 var(--f-ui); color: var(--mute); }
.rd #gp-calc #gpResExtra .gp-line b { font-weight: 600; color: var(--ink); }
.rd #gp-calc #gpResExtra .gp-ref { color: var(--ink); }
.rd #gp-calc .formula-wrapper { margin: 16px 0 0; padding: 20px; border: 1px solid var(--line); border-radius: 16px; background: transparent; }
.rd #gp-calc .formula-wrapper .label-text { margin-bottom: 8px; }
.rd #gp-calc #gpResSteps { font: 400 14px/1.55 var(--f-ui); color: var(--ink); }
.rd #gp-calc #gpResSteps .pr-step { display: block; margin: 0 0 8px; }
.rd #gp-calc #gpResSteps .pr-step:last-child { margin-bottom: 0; }
.rd #gp-calc #gpResSteps b { font-weight: 600; }
.rd #gp-calc .gp-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 0; }
.rd #gp-calc .rz-chip { display: inline-flex; align-items: center; justify-content: center; width: auto; 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; transition: background .15s; }
.rd #gp-calc .rz-chip:hover { background: var(--line); }
.rd #gp-calc .rz-chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.rd #gp-calc .gp-pay { margin: 16px 0 0; font: 400 13px/1.55 var(--f-ui); color: var(--mute); }
.rd #gp-calc .gp-pay a,
.rd #gp-calc .gp-vozvrat-res a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--accent-mid); text-underline-offset: 2px; }

/* смета */
.rd #gp-calc .gp-block { margin: 0; }
.rd #gp-calc .gp-smeta { box-sizing: border-box; padding: 20px; border: 1px solid var(--line); border-radius: 16px; background: transparent; }
.rd #gp-calc .gp-smeta > .label-text { display: block; position: static; margin: 0 0 8px; font: 400 11px/1.3 var(--f-mono); letter-spacing: 1px; text-transform: uppercase; color: var(--mute); }
.rd #gp-calc .gp-smeta-item { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin: 0; padding: 10px 0; border-bottom: 1px solid var(--line); font: 400 14px/1.45 var(--f-ui); color: var(--ink); }
.rd #gp-calc .gp-smeta-item b { font-weight: 600; white-space: nowrap; }
.rd #gp-calc .gp-smeta-del { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 8px; background: var(--tile); font: 400 18px/1 var(--f-ui); color: var(--ink); cursor: pointer; }
.rd #gp-calc .gp-smeta-del:hover { background: var(--pill); }
.rd #gp-calc .gp-smeta-when { display: block; margin-top: 2px; font: 400 12px/1.4 var(--f-ui); color: var(--mute); }
.rd #gp-calc .gp-smeta-when--old { color: var(--bad); }
.rd #gp-calc .gp-smeta-note { margin: 0 0 12px; font: 400 12px/1.4 var(--f-ui); color: var(--mute); }
.rd #gp-calc .gp-smeta-total { margin: 12px 0; font: 400 14px/1.4 var(--f-ui); color: var(--mute); }
.rd #gp-calc .gp-smeta-total b { font-weight: 600; font-size: 20px; color: var(--ink); }

/* возврат */
.rd #gp-calc .gp-mini-block { margin: 12px 0 0; }
.rd #gp-calc .gp-vozvrat-res { margin: 14px 0 0; font: 400 14px/1.7 var(--f-ui); color: var(--ink); }
.rd #gp-calc .gp-vozvrat-res:empty { display: none; }
.rd #gp-calc .gp-vozvrat-res b { font-weight: 600; }
.rd #gp-calc .gp-vozvrat-res .gp-note { display: block; margin: 6px 0 0; line-height: 1.5; color: var(--mute); }

/* таблицы ставок и формула в статье */
.rd .rd-article__body > .gp-table-scroll { margin: 0 0 16px; overflow-x: auto; }
.rd .rd-article__body .gp-table-scroll table { margin: 0; }
.rd .rd-article__body .gp-formula { margin: 0 0 16px; padding: 16px 20px; border-left: 3px solid var(--accent); border-radius: 0 14px 14px 0; background: var(--tile); font: 500 16px/1.5 var(--f-ui); color: var(--ink); }
@media (min-width: 640px) {
    .rd .rd-article__body .gp-table-scroll td:first-child { white-space: nowrap; }
}

@media (max-width: 639px) {
    .rd #gp-calc .calculator__form { gap: 14px; }
    .rd #gp-calc .custom-select__selected { padding: 12px 40px 12px 14px; font-size: 14px; }
    .rd #gp-calc .custom-select__options { max-height: 300px; }
    .rd #gp-calc .custom-select__option { font-size: 13px; }
    .rd #gp-calc .gp-mini { padding: 16px; }
    .rd #gp-calc .gp-check { font-size: 13px; }
    .rd #gp-calc .btn-wrapper { flex-direction: column; }
    .rd #gp-calc .btn-wrapper button { width: 100%; }
    .rd #gp-calc .calculator__result { padding: 16px; }
    .rd #gp-calc #gpResMain { font-size: 14px; }
    .rd #gp-calc #gpResMain b { font-size: 32px; letter-spacing: 0; }
    .rd #gp-calc #gpResExtra .gp-line,
    .rd #gp-calc #gpResSteps,
    .rd #gp-calc .gp-smeta-item,
    .rd #gp-calc .gp-vozvrat-res { font-size: 13px; }
    .rd #gp-calc .formula-wrapper,
    .rd #gp-calc .gp-smeta { padding: 16px; }
    .rd .rd-article__body .gp-formula { padding: 14px 16px; font-size: 14px; }
}

@media print {
    header, footer, .rd-hero .breadcrumb, .rd-calc-aside, .rd-article, .rd-bottom, .gp-actions, .gp-pay, .gp-mini-toggle { display: none !important; }
    .rd .rd-card { padding: 0; background: none; }
}

/* источники и дисклеймер в боковой колонке статьи */
.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; }
}
