:root {
  --primary: #1E2A5A;
  --accent: #14B8A6;
  --accent-hover: #0D9488;
  --bg: #F5F6F8;
  --card: #FFFFFF;
  --text: #1F2937;
  --muted: #6B7280;
  --border: #E5E7EB;
  --warn-bg: #FFFBEB;
  --warn-border: #F59E0B;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; background: var(--bg); color: var(--text); line-height: 1.6; }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--accent-hover); }

header { background: var(--primary); color: #fff; padding: 14px 24px; position: sticky; top: 0; z-index: 100; box-shadow: 0 2px 6px rgba(0,0,0,0.08); }
.header-inner { max-width: 1240px; margin: 0 auto; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; }
.logo { font-size: 20px; font-weight: 700; color: #fff; display: flex; align-items: center; gap: 8px; }
.logo span { color: var(--accent); }
.top-nav { display: flex; gap: 18px; flex-wrap: wrap; font-size: 14px; }
.top-nav a { color: #E5E7EB; font-weight: 500; }
.top-nav a:hover { color: #fff; }
.container { max-width: 1240px; margin: 24px auto; padding: 0 16px; display: grid; grid-template-columns: 260px 1fr; gap: 24px; }
@media (max-width: 860px) { .container { grid-template-columns: 1fr; } }
aside { background: var(--card); border-radius: 16px; padding: 18px; border: 1px solid var(--border); height: fit-content; }
.menu-group { margin-bottom: 18px; }
.menu-group h4 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin-bottom: 8px; }
.menu-group ul { list-style: none; }
.menu-group li { margin-bottom: 6px; }
.menu-group a { display: block; padding: 6px 10px; border-radius: 8px; font-size: 14px; color: var(--text); transition: 0.15s; }
.menu-group a:hover, .menu-group a.active { background: #F0FDFA; color: var(--accent-hover); font-weight: 600; }
main { min-width: 0; }
.card { background: var(--card); border-radius: 16px; padding: 24px; border: 1px solid var(--border); box-shadow: 0 1px 3px rgba(0,0,0,0.03); margin-bottom: 24px; }
h1 { font-size: 26px; color: var(--primary); margin-bottom: 8px; line-height: 1.3; }
h2 { font-size: 20px; color: var(--primary); margin: 20px 0 10px; }
h3 { font-size: 17px; color: var(--primary); margin: 16px 0 8px; }
.subtitle { color: var(--muted); font-size: 15px; margin-bottom: 18px; }
.promo-zone-slot { background: #F9FAFB; border: 1px dashed #D1D5DB; border-radius: 12px; display: flex; align-items: center; justify-content: center; color: #9CA3AF; font-size: 12px; margin: 20px 0; text-align: center; padding: 8px; }
.calc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
@media (max-width: 720px) { .calc-grid { grid-template-columns: 1fr; } }
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; color: var(--text); }
.form-group input, .form-group select { width: 100%; padding: 10px 12px; border: 1px solid #D1D5DB; border-radius: 10px; font-size: 15px; }
.form-group input:focus, .form-group select:focus { outline: none; border-color: var(--accent); }
.btn { background: var(--accent-hover); color: #fff; border: none; padding: 12px 20px; border-radius: 10px; font-size: 15px; font-weight: 600; cursor: pointer; width: 100%; transition: 0.15s; }
.btn:hover { background: #0F766E; }
.result-box { background: #F8FAFC; border: 1px solid #E2E8F0; border-radius: 14px; padding: 20px; }
.res-main { font-size: 28px; font-weight: 700; color: var(--primary); margin: 6px 0 14px; }
.res-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 8px 0; border-bottom: 1px solid #E5E7EB; font-size: 14px; }
.res-row strong { white-space: nowrap; flex-shrink: 0; text-align: right; }
.res-row:last-child { border-bottom: none; }
.short-disclaimer { margin-top: 14px; padding: 10px 12px; background: var(--warn-bg); border-left: 3px solid var(--warn-border); border-radius: 6px; font-size: 12px; color: #78350F; line-height: 1.45; }
.cards-hub { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; margin-top: 16px; }
.hub-item { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 18px; transition: 0.15s; display: block; }
.hub-item:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 6px 14px rgba(0,0,0,0.05); }
.hub-item h3 { margin-top: 0; font-size: 16px; }
.hub-item p { font-size: 13px; color: var(--muted); margin-top: 6px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 12px; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: right; }
th:first-child, td:first-child { text-align: left; }
th { background: #F8FAFC; color: var(--primary); font-weight: 600; }
footer { background: #111827; color: #9CA3AF; padding: 32px 24px; margin-top: 48px; font-size: 13px; }
.footer-inner { max-width: 1240px; margin: 0 auto; }
.footer-links { display: flex; gap: 20px; flex-wrap: wrap; margin-bottom: 16px; padding-bottom: 16px; border-bottom: 1px solid #374151; }
.footer-links a { color: #D1D5DB; }
.footer-links a:hover { color: #fff; }
.legal-text { font-size: 12px; line-height: 1.6; color: #9CA3AF; }
.promo-zone-slot { display: none; }
/* Стили банковских горизонтальных ползунков */
.range-wrap { margin-top: 8px; }
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: #E2E8F0;
  border-radius: 5px;
  outline: none;
  padding: 0;
  border: none;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.25);
  cursor: pointer;
  transition: transform 0.1s;
}
input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.12); background: var(--accent-hover); }
input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.25);
  cursor: pointer;
}
.range-limits { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 4px; }
.range-limits { display: flex; justify-content: space-between; font-size: 11px; color: #6B7280; margin-top: 4px; }
.disclaimer-full { background: #F8FAFC; border: 1px solid #CBD5E1; border-left: 4px solid var(--warn-border); }
.formula-code { background: #1E293B; color: #F8FAFC; padding: 10px 14px; border-radius: 8px; font-family: monospace; font-size: 14px; margin: 10px 0; overflow-x: auto; }
.range-limits { display: flex !important; justify-content: space-between !important; width: 100%; font-size: 11px; color: #6B7280; margin-top: 4px; }
.disclaimer-full { background: #F8FAFC; border: 1px solid #CBD5E1; border-left: 4px solid #F59E0B; }
.logo:hover { color: #FFFFFF !important; }
.table-scroll { max-height: 420px; overflow-y: auto; border: 1px solid var(--border); border-radius: 10px; margin-top: 12px; }
.table-scroll table { margin-top: 0; }
.table-scroll thead th { position: sticky; top: 0; z-index: 2; background: #F1F5F9; box-shadow: 0 1px 0 var(--border); }
/* --- Умная полоса соотношения и экспорт в PDF --- */
.ratio-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 7px;
  vertical-align: middle;
}
.ratio-dot-a { background: var(--accent); }
.ratio-dot-b { background: #3B82F6; }
.ratio-bar-wrap {
  margin: 14px 0 6px;
}
.ratio-bar-track {
  display: flex;
  width: 100%;
  height: 10px;
  background: #E2E8F0;
  border-radius: 999px;
  overflow: hidden;
}
.ratio-bar-seg-a {
  background: var(--accent);
  height: 100%;
  transition: width 0.25s ease;
}
.ratio-bar-seg-b {
  background: #3B82F6;
  height: 100%;
  transition: width 0.25s ease;
}
.ratio-bar-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--muted);
  margin-top: 5px;
}
.pdf-export-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  margin-top: 14px;
  padding: 10px 14px;
  background: #FFFFFF;
  color: var(--primary);
  border: 1.5px solid #CBD5E1;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}
.pdf-export-btn:hover {
  border-color: var(--primary);
  background: #F1F5F9;
}
#pdf-print-summary { display: none; }
@media print {
  body { background: #FFFFFF !important; color: #0F172A !important; font-size: 12px; }
  header, aside, footer, .term-pills, .range-wrap, .pdf-export-btn, .short-disclaimer a { display: none !important; }
  .container { display: block !important; max-width: 100% !important; padding: 0 !important; margin: 0 !important; }
  main { width: 100% !important; max-width: 100% !important; }
  .card { box-shadow: none !important; border: none !important; padding: 0 !important; margin-bottom: 16px !important; }
  .calc-grid { display: block !important; }
  .calc-grid > div:first-child { display: none !important; }
  #pdf-print-summary {
    display: block !important;
    border: 1px solid #CBD5E1;
    border-radius: 8px;
    padding: 12px 14px;
    margin: 12px 0 16px;
    background: #F8FAFC !important;
  }
  #pdf-print-summary h4 { margin: 0 0 8px; font-size: 13px; color: #1E2A5A; }
  .pdf-params-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 18px; font-size: 12px; }
  .result-box { border: 1px solid #CBD5E1 !important; background: #FFFFFF !important; page-break-inside: avoid; }
  .table-scroll { max-height: none !important; overflow: visible !important; border: 1px solid #CBD5E1 !important; }
  table { font-size: 11px !important; }
  th, td { padding: 5px 8px !important; }
  tr { page-break-inside: avoid; }
  .disclaimer-full { page-break-inside: avoid; margin-top: 16px !important; padding: 10px !important; border: 1px solid #CBD5E1 !important; }
  .no-print { display: none !important; }
}
/* --- Сетка рекламных слотов РСЯ (предпросмотр через ?ads=1) --- */
.promo-zone-slot {
  position: relative;
  border: 2px dashed #94A3B8;
  background: linear-gradient(135deg, #F8FAFC 0%, #EFF6FF 100%);
  border-radius: 10px;
  padding: 14px 16px;
  margin: 20px 0;
}
.promo-zone-badge {
  position: absolute;
  top: -10px;
  left: 14px;
  background: #475569;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 2px 8px;
  border-radius: 4px;
  text-transform: uppercase;
}
.promo-zone-mock-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.promo-zone-mock-title { font-weight: 700; color: #0F172A; font-size: 15px; margin-bottom: 4px; }
.promo-zone-mock-desc { font-size: 13px; color: #475569; }
.promo-zone-mock-cta {
  background: #2563EB;
  color: #fff;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}
.promo-zone-grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-top: 6px;
}
.promo-zone-mini-card {
  background: #fff;
  border: 1px solid #E2E8F0;
  border-radius: 8px;
  padding: 12px;
}
@media print {
  .promo-zone-slot { display: none; }
}
/* Явная подсветка ссылок перелинковки внутри статей */
.card p a {
  color: #0D9488;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.card p a:hover {
  color: #1E2A5A;
}

/* --- Мобильная адаптация ползунков, сайдбара и строк результатов --- */
input[type="range"] { touch-action: pan-y; }
@media (max-width: 860px) {
  aside { max-height: 240px; overflow-y: auto; padding: 12px 14px; }
  input[type="range"]::-webkit-slider-thumb { width: 24px; height: 24px; }
  input[type="range"]::-moz-range-thumb { width: 24px; height: 24px; }
}
@media (max-width: 480px) {
  .res-row { flex-wrap: wrap; gap: 4px; font-size: 13px; }
  .res-row strong { font-size: 13px; }
}
