/* === ПЕРЕМЕННЫЕ === */
:root {
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --bg: #f5f7fa;
  --surface: #ffffff;
  --text: #1a202c;
  --text-muted: #718096;
  --text-soft: #4a5568;
  --border: #e2e8f0;
}

/* === БАЗА === */
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Все прямые дети body растягиваются по ширине */
body > * {
  width: 100%;
}


/* ============================================ */
/* === ГЛАВНАЯ СТРАНИЦА === */
/* ============================================ */

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 16px 0;
}
.site-header .container {
  max-width: 1200px; margin: 0 auto; padding: 0 20px;
  display: flex; align-items: center; justify-content: space-between;
}
.logo {
  font-size: 20px; font-weight: 700;
  color: var(--text); text-decoration: none; letter-spacing: -0.3px;
}
.logo span { color: var(--accent); }
.site-header nav a {
  color: var(--text-soft); text-decoration: none;
  font-size: 14px; margin-left: 22px; transition: color 0.15s;
}
.site-header nav a:hover { color: var(--accent); }

.hero {
  max-width: 1200px; margin: 0 auto;
  padding: 48px 20px 32px; text-align: center;
}
.hero h1 {
  font-size: 34px; font-weight: 700;
  margin-bottom: 12px; letter-spacing: -0.5px;
}
.hero p {
  font-size: 17px; color: var(--text-muted);
  max-width: 640px; margin: 0 auto;
}

.categories {
  max-width: 1200px; margin: 0 auto;
  padding: 0 20px;
}
.category {
  background: var(--surface); border-radius: 12px;
  padding: 24px; margin-bottom: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.category:last-child {
  margin-bottom: 0;
}
.category-header {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 18px; padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.category-icon {
  width: 36px; height: 36px; border-radius: 8px;
  background: #eff6ff; color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0;
}
.category h2 { font-size: 19px; font-weight: 700; color: var(--text); }

.calc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}
.calc-card {
  display: block; padding: 16px 18px;
  background: #f8fafc; border: 1px solid var(--border);
  border-radius: 10px; text-decoration: none; color: var(--text);
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
}
.calc-card:hover {
  border-color: var(--accent); background: #ffffff;
  transform: translateY(-1px);
}
.calc-card .calc-title { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.calc-card .calc-desc { font-size: 13px; color: var(--text-muted); line-height: 1.45; }
.calc-card.soon { cursor: default; opacity: 0.6; }
.calc-card.soon:hover {
  border-color: var(--border); background: #f8fafc; transform: none;
}
.calc-card .badge {
  display: inline-block; font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.4px;
  color: var(--text-muted); background: #edf2f7;
  padding: 2px 7px; border-radius: 4px;
  margin-left: 6px; vertical-align: middle;
}

.site-footer {
  border-top: 1px solid var(--border);
  padding: 24px 20px;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  margin-top: auto;
}

/* ============================================ */
/* === СТРАНИЦЫ КАЛЬКУЛЯТОРОВ === */
/* ============================================ */

body.calc-page { padding: 24px 16px 0; }

.back-link {
  max-width: 1200px; margin: 0 auto 20px; display: block;
  font-size: 14px; color: var(--text-muted);
  text-decoration: none; transition: color 0.15s;
}
.back-link:hover { color: var(--accent); }

.header { max-width: 1200px; margin: 0 auto 24px; text-align: center; }
.header h1 { font-size: 28px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.header p { color: var(--text-muted); font-size: 15px; }

.layout {
  max-width: 1200px; margin: 0 auto;
  display: grid;
  grid-template-columns: 200px 1fr 280px;
  gap: 20px; align-items: start;
}

/* Реклама */
.ad-zone {
  background: #e8ecf1; border: 1px solid #d1d9e0;
  border-radius: 10px; padding: 16px 12px; text-align: center;
  min-height: 400px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.ad-zone .ad-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px;
  color: #a0aec0; margin-bottom: 8px;
}
.ad-zone .ad-placeholder { font-size: 13px; color: #a0aec0; line-height: 1.6; }

/* Калькулятор */
.calculator {
  background: var(--surface); border-radius: 12px; padding: 28px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 4px 16px rgba(0,0,0,0.04);
}
.field { margin-bottom: 18px; }
.field label {
  display: block; font-size: 14px; font-weight: 600;
  color: var(--text-soft); margin-bottom: 6px;
}

/* Поля ввода */
input[type="number"], input[type="date"], select {
  width: 100%; padding: 12px 14px; font-size: 16px;
  border: 1.5px solid #cbd5e0; border-radius: 8px;
  background: #fff; color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
  font-family: inherit;
}
input:focus, select:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
select {
  cursor: pointer; appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%234a5568' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat; background-position: right 12px center;
  background-size: 18px; padding-right: 40px;
}
.inputs-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* Чекбокс */
.checkbox-field {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 18px; user-select: none; cursor: pointer;
}
.checkbox-field input {
  width: 18px; height: 18px; accent-color: var(--accent);
  cursor: pointer; flex-shrink: 0;
}
.checkbox-field span { font-size: 14px; color: var(--text-soft); }

/* Вкладки режимов */
.mode-tabs {
  display: flex; gap: 4px;
  background: #f1f5f9; padding: 5px;
  border-radius: 10px; margin-bottom: 22px;
}
.mode-tabs button {
  flex: 1; padding: 10px 8px;
  font-size: 13px; font-weight: 600;
  color: var(--text-soft); background: transparent;
  border: none; border-radius: 7px; cursor: pointer;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
  font-family: inherit; white-space: nowrap;
}
.mode-tabs button:hover { color: var(--accent); }
.mode-tabs button.active {
  background: #ffffff; color: var(--accent);
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

/* Чипы ставок */
.rate-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.rate-chips button {
  padding: 10px 16px; font-size: 15px; font-weight: 600;
  color: var(--text-soft); background: #f8fafc;
  border: 1.5px solid var(--border); border-radius: 8px;
  cursor: pointer; transition: all 0.15s; font-family: inherit;
}
.rate-chips button:hover { border-color: var(--accent); color: var(--accent); }
.rate-chips button.active {
  background: var(--accent); border-color: var(--accent); color: #ffffff;
}
.rate-chips button[data-rate="custom"] {
  border-style: solid; border-width: 2px;
  border-color: #93c5fd; color: var(--accent);
  background: #eff6ff; padding: 9px 14px;
}
.rate-chips button[data-rate="custom"]:hover {
  border-color: var(--accent); background: #dbeafe;
}
.rate-chips button[data-rate="custom"].custom-active {
  background: var(--accent); border-color: var(--accent); color: #ffffff;
}
.custom-rate-wrap { margin-top: 10px; display: none; }
.custom-rate-wrap.visible { display: block; }

/* Кнопка */
.btn-calculate {
  width: 100%; padding: 15px; font-size: 16px; font-weight: 600;
  color: #fff; background: var(--accent);
  border: none; border-radius: 8px; cursor: pointer;
  margin-top: 6px;
  transition: background 0.15s, transform 0.05s;
  font-family: inherit;
}
.btn-calculate:hover { background: var(--accent-hover); }
.btn-calculate:active { transform: scale(0.99); }

/* Результат */
.result {
  background: #e0f2fe; border: 0 solid #bae6fd; border-radius: 10px;
  max-height: 0; padding: 0 22px; margin-top: 0; opacity: 0; overflow: hidden;
  transition:
    max-height 0.22s ease, opacity 0.18s ease,
    padding 0.22s ease, margin-top 0.22s ease, border-width 0.22s ease;
}
.result.visible {
  max-height: 800px; padding: 22px; margin-top: 22px;
  opacity: 1; border-width: 1px;
}
.result-row {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 10px 0; border-bottom: 1px solid #bae6fd;
}
.result-row:last-child { border-bottom: none; padding-bottom: 0; }
.result-row:first-child { padding-top: 0; }
.result-row .row-label { font-size: 14px; color: #075985; font-weight: 500; }
.result-row .row-value {
  font-size: 18px; color: #0c4a6e; font-weight: 700;
  text-align: right; font-variant-numeric: tabular-nums;
}
.result-row.main .row-label { font-size: 15px; font-weight: 600; }
.result-row.main .row-value { font-size: 24px; }
.result-row.income .row-value,
.result-row.savings .row-value { color: #059669; }
.result-row.savings.negative .row-value { color: #dc2626; }

/* График */
.chart-wrap { margin-top: 22px; padding-top: 18px; border-top: 1px solid #bae6fd; }
.chart-wrap canvas { width: 100%; height: 200px; display: block; }
.chart-label { font-size: 12px; color: #075985; text-align: center; margin-top: 8px; }

/* Доп. секция */
.second-price-section { display: none; margin-bottom: 18px; }
.second-price-section.visible { display: block; }

/* Сайдбар "Похожие" */
.similar {
  background: var(--surface); border-radius: 12px; padding: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.similar h3 {
  font-size: 14px; font-weight: 700; color: var(--text-soft);
  text-transform: uppercase; letter-spacing: 0.4px; margin-bottom: 14px;
}
.similar a {
  display: block; padding: 10px 12px; font-size: 14px;
  color: var(--text-soft); text-decoration: none; border-radius: 6px;
  transition: background 0.15s, color 0.15s;
  margin-bottom: 2px; border-left: 3px solid transparent;
}
.similar a:hover {
  background: #f7fafc; color: var(--accent); border-left-color: var(--accent);
}

/* Примечание */
.note {
  margin-top: 18px; font-size: 12px; color: #94a3b8;
  line-height: 1.5; text-align: center;
}

/* === АДАПТИВ === */
@media (max-width: 960px) {
  .layout { grid-template-columns: 1fr; gap: 16px; }
  .ad-zone { min-height: 120px; order: 3; }
  .calculator { order: 1; padding: 22px 18px; }
  .similar { order: 2; }
  .inputs-row { grid-template-columns: 1fr; gap: 0; }
  .result-row.main .row-value { font-size: 20px; }
  .header h1 { font-size: 22px; }
}
@media (max-width: 640px) {
  .site-header nav { display: none; }
  .hero { padding: 32px 16px 24px; }
  .hero h1 { font-size: 26px; }
  .hero p { font-size: 15px; }
  .categories { padding: 0 16px 40px; }
  .category { padding: 18px; }
  .calc-grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
body.calc-page { padding: 24px 16px 0; }
  .calculator { padding: 18px 14px; }
  .mode-tabs button { font-size: 12px; padding: 9px 4px; }
  .rate-chips button { padding: 9px 12px; font-size: 14px; }
  .result-row .row-value { font-size: 16px; }
  .result-row.main .row-value { font-size: 19px; }
}

/* ============================================ */
/* === КАЛЬКУЛЯТОР ДРОБЕЙ === */
/* ============================================ */

.fraction-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.fraction {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.fraction input {
  width: 100%;
  max-width: 130px;
  text-align: center;
  padding: 10px 8px;
  font-size: 18px;
  font-weight: 600;
}
.fraction .fraction-line {
  width: 70px;
  height: 2px;
  background: var(--text-soft);
  border-radius: 1px;
}

.operation-chips {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 20px;
}
.operation-chips button {
  padding: 14px;
  font-size: 22px;
  font-weight: 600;
  color: var(--text-soft);
  background: #f8fafc;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}
.operation-chips button:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.operation-chips button.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

/* Отображение дроби в результате */
.result-fraction {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  vertical-align: middle;
  margin: 0 6px;
}
.result-fraction .rf-num {
  padding: 0 6px;
  border-bottom: 2px solid currentColor;
  line-height: 1.3;
}
.result-fraction .rf-den {
  padding: 0 6px;
  line-height: 1.3;
}

/* ============================================ */
/* === КАЛЬКУЛЯТОР ПРОПОРЦИЙ === */
/* ============================================ */

.proportion-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px 16px;
  margin-bottom: 20px;
}

.proportion-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.proportion-cell input {
  width: 100%;
  max-width: 130px;
  text-align: center;
  padding: 10px 8px;
  font-size: 18px;
  font-weight: 600;
}
.proportion-cell .proportion-line {
  width: 70px;
  height: 2px;
  background: var(--text-soft);
  border-radius: 1px;
}

.proportion-eq {
  font-size: 26px;
  color: var(--text-soft);
  font-weight: 600;
  padding: 0 6px;
}

.proportion-hint {
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 18px;
  padding: 10px 14px;
  background: #f8fafc;
  border-radius: 8px;
  line-height: 1.5;
}

@media (max-width: 480px) {
  .fraction input, .proportion-cell input {
    max-width: 100px;
    font-size: 16px;
    padding: 9px 6px;
  }
  .fraction .fraction-line,
  .proportion-cell .proportion-line {
    width: 55px;
  }
  .proportion-eq { font-size: 22px; }
  .operation-chips button { font-size: 18px; padding: 12px; }
}

/* ============================================ */
/* === БЫСТРЫЕ КНОПКИ ДАТ === */
/* ============================================ */

.quick-dates {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}
.quick-dates button {
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-soft);
  background: #f8fafc;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}
.quick-dates button:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: #eff6ff;
}
.quick-dates button.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

/* Плавный счётчик для больших чисел */
.big-value {
  font-size: 40px;
  font-weight: 700;
  color: #0c4a6e;
  line-height: 1.1;
  letter-spacing: -0.5px;
}
.big-value .unit {
  font-size: 18px;
  font-weight: 600;
  margin-left: 6px;
}

@media (max-width: 480px) {
  .big-value { font-size: 30px; }
  .big-value .unit { font-size: 15px; }
}

/* ============================================ */
/* === КАЛЬКУЛЯТОР ИМТ === */
/* ============================================ */

.bmi-scale {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid #bae6fd;
  padding-left: 16px;
  padding-right: 16px;
}

/* Стрелка сверху, над полоской */
.bmi-scale-marker {
  position: relative;
  height: 18px;
  margin-bottom: 2px;
}
.bmi-scale-marker .arrow {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  font-size: 16px;
  line-height: 1;
  color: #0c4a6e;
  transition: left 0.4s ease;
}

/* Полоска: сегменты пропорциональны реальным диапазонам BMI */
.bmi-scale-bar {
  display: flex;
  height: 14px;
  border-radius: 7px;
  overflow: hidden;
  margin-bottom: 6px;
}
.bmi-scale-bar .seg-1 { flex: 25;  background: #60a5fa; }  /* 16 – 18.5 */
.bmi-scale-bar .seg-2 { flex: 65;  background: #34d399; }  /* 18.5 – 25 */
.bmi-scale-bar .seg-3 { flex: 50;  background: #fbbf24; }  /* 25 – 30 */
.bmi-scale-bar .seg-4 { flex: 100; background: #f87171; }  /* 30 – 40 */

/* Подписи под полоской — на границах сегментов */
.bmi-scale-labels {
  position: relative;
  height: 16px;
  font-size: 11px;
  color: var(--text-muted);
}
.bmi-scale-labels span {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  white-space: nowrap;
}

/* Плашка с интерпретацией ИМТ */
.bmi-status {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  margin-left: 8px;
  vertical-align: middle;
}
.bmi-status.status-under { background: #dbeafe; color: #1e40af; }
.bmi-status.status-normal { background: #d1fae5; color: #065f46; }
.bmi-status.status-over { background: #fef3c7; color: #92400e; }
.bmi-status.status-obese { background: #fee2e2; color: #991b1b; }

/* ============================================ */
/* === КАЛЬКУЛЯТОР КАЛОРИЙ === */
/* ============================================ */

.activity-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 8px;
}
.activity-list label {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: #f8fafc;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
}
.activity-list label:hover {
  border-color: var(--accent);
  background: #eff6ff;
}
.activity-list label.active {
  border-color: var(--accent);
  background: #eff6ff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08);
}
.activity-list input[type="radio"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}
.activity-list .act-info { display: flex; flex-direction: column; gap: 2px; }
.activity-list .act-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.activity-list .act-desc {
  font-size: 12px;
  color: var(--text-muted);
}

/* Плашки трёх целей */
.goal-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid #bae6fd;
}
.goal-card {
  text-align: center;
  padding: 14px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.6);
}
.goal-card .goal-label {
  font-size: 12px;
  color: #075985;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  font-weight: 600;
  margin-bottom: 6px;
}
.goal-card .goal-value {
  font-size: 18px;
  font-weight: 700;
  color: #0c4a6e;
  font-variant-numeric: tabular-nums;
}
.goal-card.goal-lose .goal-value { color: #059669; }
.goal-card.goal-gain .goal-value { color: #7c3aed; }

@media (max-width: 480px) {
  .goal-cards { grid-template-columns: 1fr; }
  .bmi-scale-labels { font-size: 10px; }
}

/* ============================================ */
/* === КАЛЬКУЛЯТОР ПЛИТКИ === */
/* ============================================ */

.waste-note {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
  padding: 8px 12px;
  background: #f8fafc;
  border-radius: 6px;
  line-height: 1.5;
}
.waste-note strong { color: var(--text-soft); }

/* ============================================ */
/* === КАЛЬКУЛЯТОР ОБОЕВ === */
/* ============================================ */

.info-block {
  margin-bottom: 18px;
  padding: 12px 14px;
  background: #f8fafc;
  border-radius: 8px;
  font-size: 13px;
  color: var(--text-soft);
  line-height: 1.55;
}
.info-block strong { color: var(--text); }

/* ============================================ */
/* === КАЛЬКУЛЯТОР КРЕДИТА === */
/* ============================================ */

.schedule-wrap {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid #bae6fd;
}
.schedule-wrap h4 {
  font-size: 13px;
  color: #075985;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 12px;
}
.schedule-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.schedule-table th {
  text-align: right;
  padding: 8px 6px;
  font-weight: 600;
  color: #075985;
  font-size: 12px;
  border-bottom: 1px solid #bae6fd;
  white-space: nowrap;
}
.schedule-table th:first-child { text-align: left; }
.schedule-table td {
  padding: 7px 6px;
  text-align: right;
  color: #0c4a6e;
  border-bottom: 1px solid rgba(186, 230, 253, 0.5);
  white-space: nowrap;
}
.schedule-table td:first-child {
  text-align: left;
  color: #075985;
  font-weight: 500;
}
.schedule-table tr.hidden-row { display: none; }
.schedule-table tr:last-child td { border-bottom: none; }

.schedule-more {
  text-align: center;
  margin-top: 10px;
}
.schedule-more button {
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 500;
  color: var(--accent);
  background: transparent;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}
.schedule-more button:hover {
  border-color: var(--accent);
  background: #eff6ff;
}

/* Скролл для таблицы на мобильных */
.schedule-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 480px) {
  .schedule-table { font-size: 12px; }
  .schedule-table th, .schedule-table td { padding: 6px 4px; }
}

/* Результат с длинной таблицей — без ограничения высоты */
.result.with-schedule.visible {
  max-height: 99999px;
}

/* Внутренний скролл таблицы графика */
.result.with-schedule .schedule-scroll {
  max-height: 460px;
  overflow-y: auto;
  border: 1px solid rgba(186, 230, 253, 0.6);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.4);
}

/* Заголовок таблицы остаётся видимым при прокрутке */
.result.with-schedule .schedule-table thead th {
  position: sticky;
  top: 0;
  background: #e0f2fe;
  z-index: 1;
}



/* ============================================ */
/* === МИНИ-КАЛЬКУЛЯТОР В САЙДБАРЕ === */
/* ============================================ */

/* Обёртка для правой колонки: "Другие калькуляторы" + "Калькулятор" */
.sidebar-col {
  display: flex;
  flex-direction: column;
  gap: 20px;
  align-self: start;
}

.mini-calc-wrap {
  background: var(--surface);
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.mini-calc-toggle {
  width: 100%;
  padding: 0;
  font-size: 14px;
  font-weight: 700;
  font-family: inherit;
  color: var(--text-soft);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  background: transparent;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: color 0.15s;
  text-align: left;
}
.mini-calc-toggle:hover { color: var(--accent); }
.mini-calc-toggle .arrow {
  display: inline-block;
  transition: transform 0.25s;
  font-size: 11px;
  margin-left: 8px;
}
.mini-calc-toggle.open .arrow {
  transform: rotate(180deg);
}

.mini-calc {
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  margin-top: 0;
  transition:
    max-height 0.35s ease,
    opacity 0.2s ease,
    margin 0.25s ease;
}
.mini-calc.open {
  max-height: 520px;
  opacity: 1;
  margin-top: 14px;
}

.mini-calc-display {
  background: #e0f2fe;
  border: 1px solid #bae6fd;
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 10px;
  text-align: right;
  min-height: 62px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  overflow: hidden;
}
.mini-calc-expr {
  font-size: 11px;
  color: #0369a1;
  min-height: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mini-calc-value {
  font-size: 24px;
  font-weight: 700;
  color: #0c4a6e;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mini-calc-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
.mini-calc-grid button {
  height: 42px;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  cursor: pointer;
  font-size: 16px;
  font-weight: 500;
  font-family: inherit;
  color: var(--text);
  background: #f8fafc;
  transition: background 0.1s, border-color 0.1s, color 0.1s, transform 0.05s;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
}
.mini-calc-grid button:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.mini-calc-grid button:active { transform: scale(0.95); }

.mini-calc-grid button.gray {
  color: var(--text-soft);
  background: #f1f5f9;
}
.mini-calc-grid button.gray:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.mini-calc-grid button.op {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
  font-size: 18px;
  font-weight: 600;
}
.mini-calc-grid button.op:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}
.mini-calc-grid button.op.active {
  background: #ffffff;
  color: var(--accent);
}

.mini-calc-grid button.zero {
  grid-column: span 2;
}

@media (max-width: 960px) {
  .mini-calc-wrap { display: none; }
}



/* ============================================ */
/* === ТЕКСТОВЫЕ СТРАНИЦЫ (О сайте, Контакты и т.д.) === */
/* ============================================ */

.text-page {
  max-width: 760px;
  margin: 0 auto;
  padding: 40px 24px 0;
}
.text-page h1 {
  font-size: 32px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
  letter-spacing: -0.5px;
}
.text-page .lead {
  font-size: 16px;
  color: var(--text-muted);
  margin-bottom: 32px;
  line-height: 1.6;
}
.text-page h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin: 32px 0 12px;
}
.text-page h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin: 24px 0 8px;
}
.text-page p {
  font-size: 15px;
  color: var(--text-soft);
  line-height: 1.7;
  margin-bottom: 14px;
}
.text-page ul, .text-page ol {
  margin: 0 0 16px 22px;
  font-size: 15px;
  color: var(--text-soft);
  line-height: 1.7;
}
.text-page li { margin-bottom: 6px; }
.text-page a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid rgba(37, 99, 235, 0.25);
  transition: border-color 0.15s;
}
.text-page a:hover {
  border-bottom-color: var(--accent);
}
.text-page .card {
  background: var(--surface);
  border-radius: 12px;
  padding: 24px 28px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  margin-bottom: 20px;
}
.text-page .card:last-child {
  margin-bottom: 0;
}
.text-page .contact-block {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  background: #f8fafc;
  border-radius: 10px;
  margin-bottom: 12px;
  text-decoration: none;
  color: var(--text);
  border-bottom: none;
  transition: background 0.15s;
}
.text-page .contact-block:hover {
  background: #eff6ff;
}
.text-page .contact-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: #eff6ff;
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.text-page .contact-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.text-page .contact-label {
  font-size: 13px;
  color: var(--text-muted);
}
.text-page .contact-value {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}
.text-page .updated {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-muted);
}

/* Список калькуляторов на карте сайта */
.site-map-category {
  margin-bottom: 28px;
}
.site-map-category h2 {
  margin-top: 0;
}
.site-map-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.site-map-list li {
  margin-bottom: 6px;
}
.site-map-list a {
  display: block;
  padding: 10px 14px;
  background: #f8fafc;
  border-radius: 8px;
  border-bottom: none;
  color: var(--text-soft);
  font-size: 14px;
  transition: background 0.15s, color 0.15s;
}
.site-map-list a:hover {
  background: #eff6ff;
  color: var(--accent);
}

/* Хедер для текстовых страниц */
.text-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 16px 0;
}
.text-header .container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.text-header nav a {
  color: var(--text-soft);
  text-decoration: none;
  font-size: 14px;
  margin-left: 22px;
  transition: color 0.15s;
}
.text-header nav a:hover { color: var(--accent); }
.text-header nav a.active { color: var(--accent); }

@media (max-width: 640px) {
  .text-header nav { display: none; }
  .text-page { padding: 28px 18px 40px; }
  .text-page h1 { font-size: 26px; }
  .text-page .card { padding: 20px 18px; }
}