/* Калькулятор НДС на макете редизайна. Разметка, id и подписи прежние, скрипт
   public/js/finansovie/kalkulyator-nds.js не менялся. Файл грузится раньше
   rd.css, поэтому селекторы начинаются с .rd #simple-calc.
   redesign.css сбрасывает всем input оформление (all: unset), а p делает
   inline-block с прозрачностью .7 — поля и абзацы нарисованы здесь заново. */

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

/* вкладки */
.rd #simple-calc .tabs { display: inline-flex; align-self: flex-start; max-width: 100%; box-sizing: border-box; gap: 0; margin: 0; padding: 3px; border-radius: 999px; background: var(--pill); }
.rd #simple-calc .tab-button { display: inline-flex; align-items: center; justify-content: center; height: 38px; margin: 0; padding: 0 16px; border: 0; border-radius: 999px; background: transparent; font: 400 13px/1.2 var(--f-ui); color: var(--mute); white-space: nowrap; cursor: pointer; transition: background .15s, color .15s; }
.rd #simple-calc .tab-button:hover { background: rgba(247, 248, 249, .55); color: var(--ink); }
.rd #simple-calc .tab-button.active { background: var(--tile); font-weight: 500; color: var(--ink); }
.rd #simple-calc .tab-button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.rd #simple-calc .tab-content { display: flex; flex-direction: column; gap: 24px; margin: 0; }
.rd #simple-calc .tab-content[hidden] { display: none; }

/* сумма и ставка: два поля в ряд, быстрые ставки под полем ставки */
.rd #simple-calc .form-group__wrapper { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; margin: 0; }
.rd #simple-calc .form-group__wrapper + .form-group__wrapper { margin-top: -16px; }
.rd #simple-calc .form-group { min-width: 0; margin: 0; }
.rd #simple-calc .input-row { display: flex; flex-direction: column; gap: 8px; }
.rd #simple-calc .input-row label { margin: 0; font: 400 11px/1.3 var(--f-mono); letter-spacing: 1px; text-transform: uppercase; color: var(--mute); }
.rd #simple-calc .input-row 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 #simple-calc .input-row input::placeholder { color: var(--mute); opacity: 1; font-weight: 400; }
.rd #simple-calc .input-row input::-webkit-outer-spin-button,
.rd #simple-calc .input-row input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.rd #simple-calc .input-row input:focus { border-color: var(--accent); }

.rd #simple-calc .nds-rate-block { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; width: 100%; }
.rd #simple-calc .vat-rate-options { display: inline-flex; flex-wrap: wrap; max-width: 100%; box-sizing: border-box; gap: 0; margin: 0; padding: 3px; border-radius: 22px; background: var(--pill); }
.rd #simple-calc .vat-rate-options a { display: inline-flex; align-items: center; justify-content: center; height: 32px; margin: 0; padding: 0 12px; border-radius: 999px; font: 400 13px/1 var(--f-ui); color: var(--mute); text-decoration: none; white-space: nowrap; transition: background .15s, color .15s; }
.rd #simple-calc .vat-rate-options a:hover { background: rgba(247, 248, 249, .55); color: var(--ink); }
.rd #simple-calc .vat-rate-options a.active { background: var(--tile); font-weight: 500; color: var(--ink); }
.rd #simple-calc .nds-rate-hint { display: block; min-height: 18px; margin: 0; padding: 0; font: 400 13px/18px var(--f-ui); color: var(--mute); opacity: 1; text-align: left; }

.rd #simple-calc .calc-error { display: block; margin: 0; padding: 12px 16px; border-radius: 12px; background: var(--bad-soft); color: var(--bad); font: 500 14px/1.45 var(--f-ui); opacity: 1; }
.rd #simple-calc .calc-error[hidden] { display: none; }

/* кнопки расчёта */
.rd #simple-calc .btn-wrapper { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; }
.rd #simple-calc .calculator__buttons { display: inline-flex; align-items: center; justify-content: center; width: auto; 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; transition: opacity .15s; }
.rd #simple-calc .calculator__buttons.black { height: 46px; padding: 0 28px; background: var(--ink); font: 500 15px/1.2 var(--f-ui); color: #fff; }
.rd #simple-calc .calculator__buttons:hover { opacity: .85; }

/* результат: крупная плитка налога на всю ширину, суммы без НДС и с НДС рядом */
.rd #simple-calc .calculator__result { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 12px; margin: 0; padding: 28px; border-radius: 20px; background: var(--tile); }
.rd #simple-calc .calculator__result > .label-text,
.rd #ndsHistoryWrapper > .label-text { grid-column: 1 / -1; margin: 0; font: 400 11px/1.3 var(--f-mono); letter-spacing: 1px; text-transform: uppercase; color: var(--mute); }
.rd #simple-calc .tax-result { display: flex; flex-direction: column; gap: 8px; min-width: 0; margin: 0; padding: 20px; border-radius: 16px; background: var(--card); }
.rd #simple-calc .calculator__result > .label-text + .tax-result { grid-column: 1 / -1; gap: 10px; padding: 24px; }
.rd #simple-calc .tax-result > span:first-child { font: 400 11px/1.3 var(--f-mono); letter-spacing: 1px; text-transform: uppercase; color: var(--mute); }

/* строки «число + Копировать» и «прописью + Копировать прописью» раскладываются
   так: число, под ним пропись, ниже кнопки копирования в один ряд */
.rd #simple-calc .amount-group { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 6px; min-width: 0; }
.rd #simple-calc .nds-line { display: contents; }
.rd #simple-calc .nds-value { order: 1; flex: 0 0 100%; min-width: 0; font: 600 22px/1.2 var(--f-ui); letter-spacing: -.5px; color: var(--ink); overflow-wrap: anywhere; }
.rd #simple-calc .amountInWords { order: 2; flex: 0 0 100%; min-width: 0; font: 400 13px/1.45 var(--f-ui); color: var(--mute); }
.rd #simple-calc .amountInWords:empty { display: none; }
.rd #simple-calc .nds-line .nds-copy { order: 3; }
.rd #simple-calc .calculator__result > .label-text + .tax-result .amount-group { gap: 10px 6px; }
.rd #simple-calc .calculator__result > .label-text + .tax-result .nds-value { font-size: 44px; line-height: 1.1; letter-spacing: -1.5px; }
.rd #simple-calc .calculator__result > .label-text + .tax-result .amountInWords { font-size: 15px; }

.rd #simple-calc .nds-copy { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; width: auto; max-width: 100%; margin: 0; padding: 8px 14px; border: 0; border-radius: 999px; background: var(--pill); font: 500 12px/1.3 var(--f-ui); color: var(--ink); white-space: nowrap; cursor: pointer; transition: background .15s, color .15s; }
.rd #simple-calc .nds-copy:hover { background: var(--line); }
.rd #simple-calc .nds-copy.is-copied { background: var(--good); color: #fff; }
.rd #simple-calc .nds-copy.is-failed { background: var(--bad-soft); color: var(--bad); }
.rd #simple-calc .nds-copy--wide { padding: 12px 20px; }

.rd #simple-calc .nds-result-actions,
.rd #simple-calc .nds-history-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; }
.rd #simple-calc .nds-result-actions { grid-column: 1 / -1; }

/* порядок расчёта на вкладке «Рассчитать сумму по НДС», текст строит скрипт */
.rd #simple-calc #calculationOrder { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 8px; padding: 20px; border-radius: 16px; background: var(--card); }
.rd #simple-calc #calculationOrder:empty { display: none; }
.rd #simple-calc #calculationOrder h3 { margin: 0; padding: 0; font: 400 11px/1.3 var(--f-mono); letter-spacing: 1px; text-transform: uppercase; color: var(--mute); }
.rd #simple-calc #calculationOrder p { display: block; margin: 0; font: 400 14px/1.6 var(--f-ui); color: var(--ink); opacity: 1; }

/* история расчётов */
.rd #ndsHistoryWrapper { display: flex; flex-direction: column; gap: 14px; margin: 0; padding: 24px 28px; border-radius: 20px; background: var(--tile); }
.rd #ndsHistoryWrapper.hidden { display: none; }
.rd #ndsHistoryWrapper ul { display: flex; flex-direction: column; margin: 0; padding: 0; list-style: none; }
.rd #ndsHistoryWrapper li { display: flex; align-items: center; gap: 12px; margin: 0; padding: 10px 0; border-bottom: 1px solid var(--line); }
.rd #ndsHistoryWrapper li:first-child { padding-top: 0; }
.rd #ndsHistoryWrapper li::before { content: none; }
.rd #simple-calc .nds-history-item { flex: 1 1 auto; min-width: 0; margin: 0; padding: 0; border: 0; background: none; font: 400 14px/1.45 var(--f-ui); color: var(--ink); text-align: left; cursor: pointer; }
.rd #simple-calc .nds-history-item:hover { color: var(--accent); }
.rd #simple-calc .nds-delete { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; margin: 0; padding: 4px; border: 0; border-radius: 8px; background: none; color: var(--mute); line-height: 0; cursor: pointer; }
.rd #simple-calc .nds-delete svg { width: 16px; height: 16px; }
.rd #simple-calc .nds-delete:hover { background: var(--bad-soft); color: var(--bad); }

.rd #simple-calc .nds-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* таблица ставок в статье: ставка в одну строку и жирная, как было */
.rd .rd-article__body .nds-rate-table td:first-child { white-space: nowrap; font-weight: 600; }

@media (max-width: 639px) {
    .rd #simple-calc .tabs { display: flex; flex-direction: column; align-self: stretch; border-radius: 22px; }
    .rd #simple-calc .tab-button { width: 100%; }
    .rd #simple-calc .form-group__wrapper { grid-template-columns: minmax(0, 1fr); }
    .rd #simple-calc .form-group:empty { display: none; }
    .rd #simple-calc .vat-rate-options { display: flex; flex-wrap: nowrap; width: 100%; }
    .rd #simple-calc .vat-rate-options a { flex: 1 1 auto; padding: 0 4px; }
    .rd #simple-calc .calculator__result { grid-template-columns: minmax(0, 1fr); gap: 12px; padding: 16px; }
    .rd #simple-calc .calculator__result > .label-text + .tax-result { padding: 18px; }
    .rd #simple-calc .calculator__result > .label-text + .tax-result .nds-value { font-size: 34px; letter-spacing: -1px; }
    .rd #simple-calc .nds-line .nds-copy { padding: 8px 10px; }
    .rd #simple-calc .nds-copy--wide { white-space: normal; text-align: center; }
    .rd #simple-calc .nds-result-actions,
    .rd #simple-calc .nds-history-actions { flex-direction: column; }
    .rd #simple-calc .nds-copy--wide { width: 100%; }
    .rd #ndsHistoryWrapper { padding: 20px 16px; }
}

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