/* 📊 Калькулятор диверсификации портфеля — форма и диаграмма распределения */

.calc-intro {
  color: #555;
  font-size: 0.95rem;
  line-height: 1.5;
  margin: 8px 0 0;
}

/* 🎛 Группа полей ввода */
.fieldset-group {
  border: 2px solid #0077cc;
  border-radius: 12px;
  padding: 1.2rem 1.4rem;
  margin: 1rem 0 0;
  background: #fbfdff;
}

.fieldset-group legend {
  font-weight: bold;
  font-size: 15px;
  color: #222;
  padding: 0 8px;
}

.calc-block label {
  display: block;
  margin-top: 14px;
  font-weight: bold;
  font-size: 14px;
  color: #333;
}

.calc-block label:first-child {
  margin-top: 0;
}

.calc-block input[type="text"] {
  width: 100%;
  padding: 10px 12px;
  margin-top: 6px;
  border: 1px solid #ccc;
  border-radius: 8px;
  font-size: 15px;
  background: #fff;
  box-sizing: border-box;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.calc-block input[type="text"]:hover {
  border-color: #999;
}

.calc-block input[type="text"]:focus {
  outline: none;
  border-color: #0077cc;
  box-shadow: 0 0 0 3px rgba(0, 119, 204, 0.15);
}

.calc-block button {
  margin-top: 22px;
  padding: 12px 24px;
  background: #0077cc;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  width: 100%;
  transition: background 0.2s ease;
}

.calc-block button:hover {
  background: #005fa3;
}

.calc-block button:active {
  background: #004f87;
}

/* 🎴 Карточка результата */
.result-block h2 {
  margin: 0 0 14px;
  font-size: 1.25rem;
  color: #222;
}

.result-output {
  background: #fff;
  border: 1px solid #e5e5e5;
  border-radius: 12px;
  box-shadow: none;
}

.result-placeholder {
  color: #999;
  font-size: 14px;
  text-align: center;
  margin: 10px 0;
}

.calc-error {
  padding: 14px;
  background: #fff5f5;
  border: 1px solid #f5c2c2;
  border-radius: 10px;
  color: #b3261e;
  font-size: 14px;
  line-height: 1.5;
}

/* 🍩 Диаграмма распределения */
.chart-block {
  text-align: center;
}

.chart-wrap {
  position: relative;
  display: inline-block;
  max-width: 260px;
  width: 100%;
  margin-top: 6px;
}

.donut {
  display: block;
  width: 100%;
  height: auto;
}

.donut-segment {
  transition: stroke-width 0.15s ease;
  cursor: pointer;
}

.donut-segment:hover,
.donut-segment:focus-visible {
  stroke-width: 36;
  outline: none;
}

/* Подписи долей — чернила, не цвет серии */
.donut-label {
  font-size: 11px;
  font-weight: 600;
  fill: #444;
  pointer-events: none;
}

.donut-center-value {
  font-size: 17px;
  font-weight: 700;
  fill: #222;
}

.donut-center-caption {
  font-size: 10px;
  fill: #888;
}

/* 💬 Тултип сегмента */
.chart-tooltip {
  position: absolute;
  pointer-events: none;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.16);
  padding: 8px 12px;
  min-width: 130px;
  font-size: 13px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.12s ease;
  z-index: 20;
}

.chart-tooltip.show {
  opacity: 1;
  visibility: visible;
}

/* В тултипе значение — главное, название — второстепенное */
.chart-tooltip .tt-value {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: #222;
  font-variant-numeric: tabular-nums;
}

.chart-tooltip .tt-label {
  display: block;
  font-size: 12px;
  color: #666;
  margin-top: 2px;
}

/* 📋 Легенда (идентичность серий) */
.chart-legend {
  margin-top: 14px;
  text-align: left;
}

.legend-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 2px;
  border-bottom: 1px solid #f0f0f0;
  font-size: 13px;
}

.legend-row:last-child {
  border-bottom: none;
}

.legend-swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex: none;
}

.legend-label {
  flex: 1;
  color: #333;
}

.legend-value {
  text-align: right;
}

.legend-value strong {
  display: block;
  font-weight: 700;
  color: #222;
  font-variant-numeric: tabular-nums;
}

.legend-value span {
  display: block;
  font-size: 11px;
  color: #888;
  font-variant-numeric: tabular-nums;
}

/* 🔢 Показатели портфеля */
.stats-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 18px;
}

.stat-tile {
  background: #f7f9fc;
  border: 1px solid #e5e9f0;
  border-radius: 10px;
  padding: 12px 10px;
  text-align: center;
}

.stat-label {
  font-size: 12px;
  color: #777;
}

.stat-value {
  margin-top: 3px;
  font-size: 1.3rem;
  font-weight: 700;
  color: #222;
  font-variant-numeric: tabular-nums;
}

/* 🚦 Вердикт и рекомендация (статусные цвета — только для состояния) */
.verdict-box {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 10px;
  border-left: 4px solid;
  text-align: left;
}

.verdict-box.good {
  background: #f0faf0;
  border-color: #0ca30c;
}

.verdict-box.warning {
  background: #fff8e6;
  border-color: #fab219;
}

.verdict-box.serious {
  background: #fef1ec;
  border-color: #ec835a;
}

.verdict-box.critical {
  background: #fdecec;
  border-color: #d03b3b;
}

.verdict-title {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-weight: 700;
  font-size: 15px;
  color: #222;
}

.verdict-badge {
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
}

.verdict-badge.good {
  background: #0ca30c;
}

.verdict-badge.warning {
  background: #fab219;
  color: #4d3b00;
}

.verdict-badge.serious {
  background: #ec835a;
}

.verdict-badge.critical {
  background: #d03b3b;
}

.verdict-text {
  margin-top: 8px;
  font-size: 13px;
  color: #444;
  line-height: 1.55;
}

/* 📋 Таблица распределения (табличное представление — доступ без наведения) */
.allocation-title {
  margin: 18px 0 0;
  font-size: 14px;
  color: #333;
  text-align: left;
}

.allocation-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
  font-size: 14px;
  text-align: left;
}

.allocation-table th,
.allocation-table td {
  padding: 8px 10px;
  border-bottom: 1px solid #e5e5e5;
}

.allocation-table th {
  background: #f5f5f5;
  font-size: 13px;
}

.allocation-table td:last-child,
.allocation-table td:nth-last-child(2) {
  text-align: right;
  font-weight: 700;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.alloc-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  margin-right: 8px;
}

/* 📌 Примечание */
.result-note {
  font-size: 12px;
  color: #888;
  margin-top: 14px;
  line-height: 1.5;
  border-top: 1px dashed #ddd;
  padding-top: 10px;
  text-align: left;
}
