/* ==========================================================================
   /tools/materinskiy-kapital — калькулятор материнского капитала
   Блоки статьи и результата — общие с «Семейной выплатой» (sv-*), элементы формы —
   общие для инструментов (tool-form.css, tf-*): оба подключаются через CSS_DEPS.
   Здесь — бирюзовый акцент раздела «Пособия», вкладки, строки трат, результат, таблицы.
   ========================================================================== */
.mk-page {
  --tf-accent: #23786f;
  --tf-accent-soft: #dcefeb;
  --tf-line: #d9e7e4;
}

.mk-page [hidden] {
  display: none !important;
}

/* Фон шапки на компьютере: солнечная гостиная, центр пустой под заголовок */
.mk-page .sv-hero {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.35) 0%, rgba(220, 239, 235, 0.72) 100%),
    url("/assets/images/materinskiy-kapital-hero-bg.webp") center / cover no-repeat,
    linear-gradient(180deg, #ffffff 0%, #dcefeb 100%) !important;
}

/* ---------- Вкладки ---------- */
.mk-tabs {
  margin-bottom: 20px;
}

.mk-tabs label {
  min-height: 46px;
}

/* ---------- Выпадающий список ---------- */
.mk-select {
  position: relative;
}

.mk-select select {
  width: 100%;
  height: 48px;
  padding: 0 40px 0 14px;
  border: 1.5px solid var(--tf-line);
  border-radius: 12px;
  background: var(--tf-field);
  font: 600 16px/1 "Nunito", sans-serif;
  color: var(--main-bg-color);
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}

.mk-select::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 16px;
  width: 8px;
  height: 8px;
  margin-top: -6px;
  border-right: 2px solid var(--tf-accent);
  border-bottom: 2px solid var(--tf-accent);
  transform: rotate(45deg);
  pointer-events: none;
}

/* с JS вместо select — свой список (tf-combo): своя стрелка, у обёртки её убираем */
.mk-select:has(.tf-combo)::after {
  display: none;
}

.mk-select .tf-combo-btn {
  min-height: 48px;
  padding: 8px 14px;
  border-radius: 12px;
  background: var(--tf-field);
}

.mk-select .tf-combo-value {
  font: 600 16px/1.2 "Nunito", sans-serif;
  color: var(--main-bg-color);
}

.mk-select .tf-combo-list li {
  font-variant-numeric: tabular-nums;
}

/* шторка на телефоне лежит в body, вне .mk-page — акцент страницы задаём ей самой */
.mk-combo-panel {
  --tf-accent: #23786f;
  --tf-accent-soft: #dcefeb;
  --tf-line: #d9e7e4;
}

.mk-combo-panel .tf-combo-list li.is-active {
  background: #eef6f4;
}

.mk-select select:focus-visible {
  outline: 2px solid var(--tf-accent);
  outline-offset: 2px;
}

.mk-page .tf-group > .mk-select {
  margin-top: 6px;
}

/* ---------- Сертификат: две плашки с суммой и подписью ---------- */
.mk-cert label {
  flex-direction: column;
  gap: 4px;
  padding: 10px;
}

.mk-cert label b {
  font: 800 16px/1.2 "Montserrat", sans-serif;
  color: var(--main-bg-color);
}

.mk-cert label small {
  font: 600 12px/1.3 "Nunito", sans-serif;
  color: var(--dark-text-color);
}

/* ---------- Траты: сумма, год, удалить ---------- */
.mk-page .mk-spends {
  display: grid;
  gap: 8px;
  margin: 6px 0 0 !important;
  padding: 0 !important;
  list-style: none;
}

.mk-page .mk-spend {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 130px 40px;
  gap: 8px;
  align-items: center;
  margin: 0 !important;
  padding: 0 !important;
  list-style: none;
}

.mk-spend .tf-money,
.mk-spend .mk-select {
  margin: 0;
}

/* сумма в строке траты — на высоте списка года, шрифт спокойнее, чем у одиночного поля */
.mk-spend .tf-money input {
  height: 48px;
  padding-right: 34px;
  border-radius: 12px;
  font-size: 18px;
}

.mk-spend .tf-money span {
  right: 12px;
  font-size: 16px;
}

.mk-spend-del {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--dark-text-color);
  cursor: pointer;
}

.mk-spend-del:hover {
  background: var(--tf-accent-soft);
  color: var(--main-bg-color);
}

.mk-add {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  padding: 8px 14px 8px 10px;
  border: 1.5px dashed var(--tf-line);
  border-radius: 999px;
  background: transparent;
  font: 700 14px "Montserrat", sans-serif;
  color: var(--tf-accent);
  cursor: pointer;
}

.mk-add:hover {
  border-color: var(--tf-accent);
}

.mk-add svg {
  width: 16px;
  height: 16px;
}

.mk-rest-how {
  margin-bottom: 14px;
}

.mk-date {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 120px;
  gap: 8px;
}

.mk-page .mk-label-gap {
  margin-top: 14px;
}

/* быстрые суммы маткапитала */
.mk-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.mk-quick button {
  padding: 7px 12px;
  border: 1.5px solid var(--tf-line);
  border-radius: 999px;
  background: #fff;
  font: 700 13px "Nunito", sans-serif;
  color: var(--main-bg-color);
  cursor: pointer;
}

.mk-quick button:hover {
  border-color: var(--tf-accent);
}

.mk-page .mk-error {
  margin: 0 0 12px !important;
  padding: 12px 14px;
  border-radius: 12px;
  background: #fdecea;
  font: 700 14px/1.4 "Nunito", sans-serif;
  color: #9b2c22;
}

.mk-page .mk-error:focus {
  outline: none;
}

/* ---------- Результат ---------- */
.mk-card,
.mk-extra {
  padding: 20px 22px;
  border: 1px solid var(--tf-line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.88);
}

.mk-page .mk-title {
  margin: 0 !important;
  font: 800 22px/1.25 "Montserrat", sans-serif !important;
  letter-spacing: -0.01em !important;
  text-transform: none !important;
  color: var(--main-bg-color);
}

.mk-page .mk-title:focus {
  outline: none;
}

.mk-num {
  display: block;
  margin-top: 6px;
  font-size: 34px;
  font-weight: 900;
  letter-spacing: -0.02em;
  color: var(--tf-accent);
  font-variant-numeric: tabular-nums;
}

.mk-page .mk-text {
  margin: 12px 0 0 !important;
  font-size: 15px !important;
  line-height: 1.6;
  color: var(--dark-text-color);
}

.mk-text span + span::before {
  content: "";
  display: block;
  height: 8px;
}

.mk-page .mk-rows {
  margin: 14px 0 0 !important;
  padding: 12px 0 0 !important;
  border-top: 1px dashed var(--tf-line);
  list-style: none;
}

.mk-page .mk-rows li {
  margin: 0 0 4px !important;
  padding: 0 !important;
  font-size: 14px !important;
  color: var(--main-bg-color);
  font-variant-numeric: tabular-nums;
}

.mk-page .mk-extra .sv-block-title {
  margin: 0 0 10px !important;
}

.mk-page .mk-extra p {
  margin: 0 0 10px !important;
  font-size: 14.5px !important;
  line-height: 1.55;
  color: var(--dark-text-color);
}

.mk-page .mk-list {
  margin: 8px 0 12px !important;
  padding: 0 !important;
}

.mk-page .mk-list li {
  position: relative;
  margin: 0 0 8px !important;
  padding-left: 16px !important;
  font-size: 14.5px !important;
  line-height: 1.55 !important;
  list-style: none;
  color: var(--dark-text-color);
}

.mk-page .mk-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.62em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--tf-accent);
}

.mk-page .mk-small {
  margin-bottom: 0 !important;
  font-size: 13px !important;
}

.mk-page .mk-disclaimer {
  margin: 0 !important;
  font-size: 13px !important;
  line-height: 1.5;
  color: #5d6a68;
}

/* ---------- Статья ---------- */
.mk-table-wrap {
  margin: 16px 0 12px;
  overflow-x: auto;
  border: 1px solid var(--tf-line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.88);
}

.mk-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14.5px;
}

.mk-table th,
.mk-table td {
  padding: 10px 12px;
  text-align: right;
  border-bottom: 1px solid #edf3f2;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.mk-table th {
  font: 700 12.5px/1.3 "Montserrat", sans-serif;
  color: #536361;
  background: #f1f7f6;
  white-space: normal;
}

.mk-table th:first-child,
.mk-table td:first-child,
.mk-table th:last-child,
.mk-table td:last-child {
  text-align: left;
}

.mk-table td:first-child {
  font-weight: 700;
  color: var(--main-bg-color);
}

.mk-table tr:last-child td {
  border-bottom: 0;
}

.mk-table-uses td {
  white-space: normal;
}

.mk-table-uses td:first-child {
  font-weight: 500;
  color: var(--dark-text-color);
}

.mk-table-uses td:last-child {
  font-weight: 700;
  white-space: nowrap;
  color: var(--main-bg-color);
}

.mk-page .mk-table-note {
  margin-top: -2px !important;
  font-size: 13px !important;
  line-height: 1.5;
  color: #5d6a68;
}

.mk-page .mk-formula {
  margin: 14px 0 !important;
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--tf-accent-soft);
  font: 700 15.5px/1.45 "Montserrat", sans-serif !important;
  color: var(--main-bg-color);
}

.mk-page .mk-steps {
  margin: 10px 0 14px !important;
  padding-left: 22px !important;
}

.mk-page .mk-steps li {
  margin: 0 0 6px !important;
  font-size: inherit !important;
  line-height: 1.6;
}

/* Ссылки в тексте статьи — как в статьях других инструментов */
.mk-page .sv-article a {
  color: var(--gold-color);
  font-weight: 700;
  text-decoration: underline;
  text-decoration-color: rgba(189, 160, 0, 0.35);
  text-underline-offset: 3px;
}

.mk-page .sv-article a:hover {
  color: var(--main-bg-color);
  text-decoration-color: currentColor;
}

/* Примечание под источниками: строка с иконкой «i», как у единого пособия */
.mk-page .sr-sources-note {
  display: flex;
  gap: 10px;
  margin: 18px 0 0 !important;
  padding: 16px 0 0 !important;
  border: 0 !important;
  border-top: 1px dashed #e6dfc6 !important;
  border-radius: 0 !important;
  background: none !important;
  font-style: normal !important;
  font-size: 13px !important;
  line-height: 1.55 !important;
  color: #6b6555;
}

.mk-page .sr-sources-note::before {
  content: "";
  flex: none;
  width: 18px;
  height: 18px;
  margin-top: 1px;
  background: var(--gold-color);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M12 16v-4M12 8h.01'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M12 16v-4M12 8h.01'/%3E%3C/svg%3E") center / contain no-repeat;
}

@media (max-width: 900px) {
  .mk-table th,
  .mk-table td {
    padding: 10px 8px;
  }
}

/* заголовок на компьютере сразу в две строки — без сдвига вёрстки, когда догрузится Montserrat */
@media (min-width: 640px) {
  .mk-page .mk-hero-title span,
  .mk-page .mb-hero-title span {
    display: block;
  }
}

/* ---------- Телефон ---------- */
@media (max-width: 639px) {
  .mk-form {
    padding: 0 !important;
  }
  .mk-form .sv-form-sub {
    margin-bottom: 14px !important;
  }
  .mk-tabs label {
    padding: 6px;
    font-size: 12.5px !important;
    line-height: 1.15 !important;
  }
  .mk-card {
    padding: 18px 16px;
  }
  .mk-extra {
    padding: 0;
    border: 0;
    background: none;
  }
  .mk-num {
    font-size: 30px;
  }
  .mk-page .mk-spend {
    grid-template-columns: minmax(0, 1fr) 104px 36px;
    gap: 6px;
  }
  .mk-select-sm .tf-combo-btn {
    gap: 4px;
    padding: 8px 8px 8px 10px;
  }
  .mk-select-sm .tf-combo-value {
    white-space: nowrap;
    overflow-wrap: normal;
  }
  .mk-spend-del {
    width: 36px;
    height: 36px;
  }
  .mk-page section.sv-article,
  .mk-page section.sv-related,
  .mk-page section.faq-section,
  .mk-page section.sv-results {
    padding: 0 !important;
    margin: 0 0 30px !important;
  }
  .mk-page section.sr-sources-block {
    margin: 0 0 30px !important;
  }
  .mk-page .sv-results {
    gap: 12px;
  }
  .mk-page .calc-share {
    margin: 14px 0 26px;
  }
  .mk-page .sv-results > .th-flat {
    margin-top: 16px !important;
  }
  .mk-table {
    font-size: 13px;
  }
  .mk-table th,
  .mk-table td {
    padding: 9px 6px;
  }
  /* таблица сумм помещается в экран: без столбца индексации (проценты есть в тексте выше) */
  .mk-table-sums th:last-child,
  .mk-table-sums td:last-child {
    display: none;
  }
  .mk-table-sums th:nth-last-child(2),
  .mk-table-sums td:nth-last-child(2) {
    text-align: right;
  }
  .mk-table-sums th {
    font-size: 11px;
  }
  .mk-table-sums td {
    font-size: 12.5px;
  }
}

@media (max-width: 359px) {
  .mk-cert {
    flex-direction: column;
  }
  .mk-table-sums th,
  .mk-table-sums td {
    padding: 8px 4px;
  }
  .mk-table-sums td {
    font-size: 11.5px;
  }
  /* год траты уходит под сумму */
  .mk-page .mk-spend {
    grid-template-columns: minmax(0, 1fr) 34px;
  }
  .mk-spend .mk-select {
    grid-column: 1;
    grid-row: 2;
  }
}
