/* =====================================================================
   Слой приложения для профессиональных инструментов (/pro/), 22.09.2026.
   Надстройка над css/calc-pro.css: вкладки режимов, редактор маслулей,
   лоах силукин, графики и сравнение предложений. Токены и шрифт — из design.css,
   отдельного дизайна здесь нет: это тот же инструмент, только большой.
   Живёт под .msi-calc--app, другие калькуляторы не затронуты.
   ===================================================================== */

/* ---------- Вкладки режимов ---------- */
.msi-calc--app { padding: 0; }
.msi-tabs {
  display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none;
  background: var(--ms-bg, #F6F8FB); border-bottom: 1px solid var(--ms-border, #E4E8EF);
  padding: 0 10px; -webkit-overflow-scrolling: touch;
}
.msi-tabs::-webkit-scrollbar { display: none; }
.msi-tab {
  flex: none; min-height: 48px; padding: 12px 16px; border: 0; background: none;
  font: inherit; font-size: 14px; font-weight: 700; color: var(--ms-muted, #5B6778);
  cursor: pointer; border-bottom: 3px solid transparent; white-space: nowrap;
}
.msi-tab:hover { color: var(--ms-navy, #0B1F3A); }
.msi-tab.is-active { color: var(--ms-navy, #0B1F3A); border-bottom-color: var(--ms-amber, #F5B301); background: #fff; }
.msi-panel[hidden] { display: none; }

/* ---------- Мелочи формы, которых нет в базовом наборе ---------- */
.msi-calc--app .msi-hint, .msi-calc--app .msi-field__hint {
  display: block; color: var(--msi-muted); font-size: 12px; line-height: 1.5; margin-top: 6px;
}
.msi-calc--app .msi-input--select select {
  width: 100%; height: 100%; border: 0; background: none; font: inherit; font-size: 16px; color: inherit; padding: 0 4px;
}
.msi-calc--app .msi-input input[readonly] { color: var(--msi-muted); background: var(--ms-bg, #F6F8FB); }
.msi-calc--app .msi-check { align-items: flex-start; font-size: 13px; line-height: 1.55; margin-top: 10px; color: var(--msi-text); }
.msi-calc--app .msi-check input { margin-top: 3px; flex: none; width: 18px; height: 18px; font-size: 16px; }
.msi-calc--app .msi-check[hidden] { display: none; }
.msi-calc--app .msi-field[hidden] { display: none; }

/* ---------- Редактор маслулей ---------- */
.msi-tracks { display: grid; gap: 12px; }
.msi-track { border: 1px solid var(--ms-border, #E4E8EF); border-radius: 12px; padding: 14px 16px; background: #fff; }
.msi-track__head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.msi-track__head b { font-size: 14.5px; color: var(--ms-navy, #0B1F3A); }
.msi-track__tag {
  background: var(--ms-bg, #F6F8FB); border: 1px solid var(--ms-border, #E4E8EF); border-radius: 999px;
  padding: 4px 10px; font-size: 12px; color: var(--msi-muted); unicode-bidi: isolate;
}
.msi-track__del {
  margin-inline-start: auto; min-height: 36px; padding: 6px 12px; border: 1px solid #E8C4C0; border-radius: 8px;
  background: #FDF0EE; color: #8E2A20; font: inherit; font-size: 12.5px; font-weight: 700; cursor: pointer;
}
.msi-track__del:hover { background: #F8DFDB; }
.msi-track .msi-calc__grid { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px 12px; }
.msi-track .msi-input { height: 40px; }
/* 16 px, иначе iOS зумит поле при фокусе (правило проекта для всех калькуляторов) */
.msi-track .msi-input input, .msi-track .msi-input select { font-size: 16px; }

/* ---------- Полоса «сколько собрано из суммы» ---------- */
.msi-progress-row { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 14px; font-size: 14px; }
.msi-progress-row b { color: var(--ms-navy, #0B1F3A); }
.msi-progress { height: 8px; border-radius: 999px; background: var(--ms-border, #E4E8EF); margin-top: 7px; overflow: hidden; }
.msi-progress span { display: block; height: 100%; width: 0; background: var(--ms-navy-2, #14305A); transition: width .15s ease; }
.msi-progress span.is-ok { background: var(--ms-teal, #0E9F6E); }
.msi-progress span.is-over { background: var(--ms-red, #D64545); }

/* ---------- Метрики стресс-сценария: тот же набор, но тише ---------- */
.msi-cards--stress .msi-card { background: transparent; border: 1px dashed var(--ms-border, #E4E8EF); }
.msi-cards--stress .msi-card strong { font-size: 18px; }

/* ---------- Графики ---------- */
.msi-charts { display: grid; gap: 14px; margin-top: 18px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.msi-chart { margin: 0; border: 1px solid var(--ms-border, #E4E8EF); border-radius: 12px; padding: 12px 14px 8px; background: #fff; }
.msi-chart figcaption { font-size: 13px; font-weight: 700; color: var(--ms-navy, #0B1F3A); margin-bottom: 6px; }
.msi-chart canvas { width: 100%; height: 220px; display: block; }
.msi-chart-tip {
  margin-top: 8px; font-size: 12.5px; color: var(--msi-muted); unicode-bidi: isolate;
  background: var(--ms-bg, #F6F8FB); border-radius: 8px; padding: 7px 10px;
}
.msi-chart-tip[hidden] { display: none; }

/* ---------- Лоах силукин ---------- */
.msi-calc--app .msi-table td { unicode-bidi: isolate; font-variant-numeric: tabular-nums; }
.msi-calc--app .msi-table tbody tr:nth-child(even) { background: var(--ms-bg, #F6F8FB); }
.msi-page { display: inline-flex; align-items: center; padding: 0 10px; font-size: 13px; font-weight: 700; color: var(--ms-navy, #0B1F3A); }

/* ---------- Сохранение и сравнение предложений ---------- */
.msi-save-row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin: 14px 0; }
.msi-save-row .msi-field { flex: 1 1 260px; margin: 0; }
.msi-btn-main {
  min-height: 44px; padding: 10px 20px; border: 0; border-radius: 10px;
  background: var(--ms-navy, #0B1F3A); color: #fff; font: inherit; font-size: 14px; font-weight: 800; cursor: pointer;
}
.msi-btn-main:hover { background: var(--ms-navy-2, #14305A); }
.msi-offers { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.msi-offer { border: 1px solid var(--ms-border, #E4E8EF); border-radius: 12px; padding: 14px 16px; background: #fff; position: relative; }
.msi-offer.is-best { border-color: var(--ms-teal, #0E9F6E); box-shadow: 0 0 0 1px var(--ms-teal, #0E9F6E) inset; }
.msi-offer__head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.msi-offer__head b { font-size: 14.5px; color: var(--ms-navy, #0B1F3A); }
.msi-offer dl { display: grid; gap: 6px; margin: 0; }
.msi-offer dl > div { display: flex; justify-content: space-between; gap: 10px; font-size: 13.5px; }
.msi-offer dt { color: var(--msi-muted); margin: 0; font-weight: 400; }
.msi-offer dd { margin: 0; font-weight: 700; color: var(--msi-text); unicode-bidi: isolate; }
.msi-offer__badge {
  display: inline-block; margin-top: 10px; background: #EAF7F1; color: #0A5C3E;
  border-radius: 999px; padding: 4px 10px; font-size: 12px; font-weight: 700;
}

/* ---------- Вкладка источников ---------- */
.msi-notes-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.msi-note-card { border: 1px solid var(--ms-border, #E4E8EF); border-radius: 12px; padding: 13px 15px; background: #fff; }
.msi-note-card b { display: block; color: var(--ms-navy, #0B1F3A); font-size: 14px; margin-bottom: 5px; }
.msi-note-card p { margin: 0; font-size: 13.5px; line-height: 1.6; color: var(--msi-text); }
.msi-calc--app .msi-sources { list-style: none; padding-inline-start: 0; margin: 14px 0 0; display: grid; gap: 9px; font-size: 13.5px; line-height: 1.6; }
.msi-calc--app .msi-sources li { margin: 0; }
.msi-calc--app .msi-sources li::before, .msi-calc--app .msi-sources li::marker { content: none !important; }
.msi-calc--app .msi-sources a { font-weight: 700; }

/* ---------- Телефон ---------- */
@media (max-width: 640px) {
  .msi-tab { padding: 12px 12px; font-size: 13.5px; }
  .msi-track { padding: 12px 13px; }
  /* На телефоне плотность уступает пальцу: поля и кнопки маслулей до 44 px */
  .msi-track .msi-input { height: 44px; }
  .msi-track__del { min-height: 44px; padding: 10px 14px; }
  .msi-offers, .msi-notes-grid, .msi-charts { grid-template-columns: 1fr; }
  .msi-save-row .msi-btn-main { width: 100%; }
}

/* ---------- Печать: на лист уходит только открытая вкладка ---------- */
@media print {
  .msi-tabs, .msi-track__del, .msi-page, .msi-save-row, .msi-progress { display: none !important; }
  .msi-panel[hidden] { display: none !important; }
  .msi-track, .msi-offer, .msi-note-card, .msi-chart { break-inside: avoid; border-color: #000; }
  .msi-chart canvas { max-height: 180px; }
  .msi-calc--app .msi-table tbody tr:nth-child(even) { background: #fff; }
  .msi-chart-tip { display: none !important; }
}

/* ---------- Таблица-форма: ввод прямо в ячейках (сравнение программ) ---------- */
.msi-cellinput {
  width: 100%; min-width: 64px; min-height: 40px; padding: 8px 10px;
  border: 1px solid var(--ms-border, #E4E8EF); border-radius: 8px; background: #fff;
  font: inherit; font-size: 16px; color: var(--msi-text);
}
.msi-cellinput--wide { min-width: 150px; }
.msi-table--compare td { white-space: normal; padding: 8px 10px; }
.msi-calc--app .msi-table tr.is-best td { background: #EAF7F1; }
.msi-calc--app .msi-table tr.is-best td:first-child { box-shadow: inset 3px 0 0 var(--ms-teal, #0E9F6E); }
.msi-badge { display: inline-block; background: var(--ms-teal, #0E9F6E); color: #fff; border-radius: 999px;
  padding: 2px 8px; font-size: 11px; font-weight: 700; margin-inline-start: 6px; }
.msi-table-wrap--tall { max-height: 460px; overflow-y: auto; }
.msi-table-wrap--tall thead th { position: sticky; top: 0; z-index: 1; }

/* Имя клиента: только на распечатке, на экране его держит поле ввода */
.msi-print-client { display: none; }
@media print {
  .msi-print-client { display: block !important; font-weight: 700; margin-bottom: 10px; }
  .msi-table-wrap--tall { max-height: none; overflow: visible; }
  .msi-cellinput { border: 0; padding: 0; }
}
@media (max-width: 640px) {
  .msi-cellinput { min-height: 44px; }
}

/* Переключатель режима расчёта: радио наследуют 15px из темы, а аудит требует 16 у любого поля */
.msi-calc--app .msi-calc__mode { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 0 0 14px; }
.msi-calc--app .msi-calc__mode label { display: inline-flex; align-items: center; gap: 7px; font-size: 14px; font-weight: 600; color: var(--ms-navy, #0B1F3A); cursor: pointer; }
.msi-calc--app .msi-calc__mode input { font-size: 16px; width: 18px; height: 18px; }
.msi-calc--app .msi-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 0; }
.msi-calc--app .msi-chips button { min-height: 44px; padding: 10px 14px; border: 1px solid var(--ms-border, #E4E8EF);
  border-radius: 999px; background: #fff; font: inherit; font-size: 13px; font-weight: 700; color: var(--ms-navy, #0B1F3A); cursor: pointer; }
.msi-calc--app .msi-chips button:hover { border-color: var(--ms-navy, #0B1F3A); background: var(--ms-bg, #F6F8FB); }

/* --- מחזור משכנתא (/refinance-pro/): маслуль, помеченный к мехзору, и списки шагов --- */
.msi-calc-refinancepro .msi-track.is-refi { border-color: var(--ms-teal, #0E9F6E); box-shadow: inset 3px 0 0 var(--ms-teal, #0E9F6E); }
.msi-calc-refinancepro .msi-track .msi-check { margin-top: 10px; }
.msi-calc--app .msi-subhead { margin: 18px 0 8px; font-size: 15px; font-weight: 800; color: var(--ms-navy, #0B1F3A); }
.msi-calc--app .msi-steps-list { margin: 0; padding-inline-start: 20px; display: grid; gap: 10px; font-size: 14px; line-height: 1.6; }
.msi-calc--app .msi-steps-list b { color: var(--ms-navy, #0B1F3A); }
.msi-calc--app .msi-offers-edit { display: grid; gap: 12px; margin-bottom: 16px; }
@media (min-width: 900px) { .msi-calc--app .msi-offers-edit { grid-template-columns: repeat(3, 1fr); } }
.msi-calc--app .msi-table-wrap > .msi-table > caption { width: 0; min-width: 100%; white-space: normal; text-align: start; }
