* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: #0f1419;
  color: #d4d8dd;
  font-size: 14px;
}
.app { max-width: 1600px; margin: 0 auto; padding: 16px; }

/* === Шапка === */
.header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 24px;
  align-items: center;
  padding: 16px 20px;
  background: #1a2028;
  border-radius: 8px;
  margin-bottom: 12px;
}
.header-title { display: flex; flex-direction: column; gap: 4px; }
h1 { font-size: 20px; color: #4ec9b0; }
.round-badge {
  background: #2d3743; padding: 3px 10px; border-radius: 12px;
  font-size: 12px; color: #9cdcfe; width: fit-content;
}

.coverage-block { min-width: 320px; max-width: 560px; justify-self: center; width: 100%; }
.coverage-label {
  font-size: 11px; color: #7a8590; text-transform: uppercase;
  letter-spacing: 0.05em; margin-bottom: 4px;
}
.coverage-bar-outer {
  height: 26px; background: #232b36; border-radius: 13px;
  position: relative; overflow: hidden; border: 1px solid #2d3743;
}
.coverage-bar-inner {
  height: 100%; border-radius: 13px;
  transition: width 0.6s ease-out, background 0.4s;
  background: #4ec9b0;
}
.coverage-bar-inner.danger { background: #e05252; }
.coverage-bar-inner.warn   { background: #e0a020; }
.coverage-bar-inner.good   { background: #4ec9b0; }
.coverage-target {
  position: absolute; left: 66.66%; top: 0; bottom: 0;
  width: 2px; background: #9cdcfe; opacity: 0.6;
}
.coverage-value {
  font-size: 13px; font-weight: 600; color: #e6e8eb;
  margin-top: 4px; text-align: center;
}

.header-metrics { display: flex; gap: 16px; }
.metric { text-align: right; min-width: 64px; }
.metric .label { font-size: 10px; color: #7a8590; display: block; text-transform: uppercase; letter-spacing: 0.05em; }
.metric .value { font-size: 16px; font-weight: 600; color: #e6e8eb; }
.metric.warn .value { color: #e0a020; }
.metric.danger .value { color: #e05252; }
.metric.good .value { color: #4ec9b0; }

/* === Сетка === */
.main {
  display: grid;
  grid-template-columns: 360px 1fr 320px;
  gap: 12px;
  align-items: start;
}
.center-column { display: flex; flex-direction: column; gap: 12px; }

.panel {
  background: #1a2028;
  border-radius: 8px;
  padding: 14px;
}
.controls { max-height: calc(100vh - 100px); overflow-y: auto; }
.delta-panel { max-height: calc(100vh - 100px); overflow-y: auto; }

.panel h2 {
  font-size: 12px; color: #4ec9b0; text-transform: uppercase;
  letter-spacing: 0.05em; margin: 14px 0 10px; font-weight: 600;
}
.panel h2:first-child { margin-top: 0; }

/* === Слайдеры === */
.slider-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.slider-row label { flex: 1; color: #9ba5b0; font-size: 13px; }
.slider-row input[type=range] {
  flex: 1; accent-color: #4ec9b0; cursor: pointer;
  height: 4px; background: #2d3743; border-radius: 2px;
  -webkit-appearance: none; appearance: none;
}
.slider-row input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 14px; height: 14px; border-radius: 50%;
  background: #4ec9b0; cursor: pointer; border: 2px solid #1a2028;
}
.slider-row input[type=range]::-moz-range-thumb {
  width: 14px; height: 14px; border-radius: 50%;
  background: #4ec9b0; cursor: pointer; border: 2px solid #1a2028;
}
.slider-row span {
  min-width: 44px; text-align: right; font-weight: 600; color: #e6e8eb;
}

/* === Бюджет === */
.budget-info {
  padding: 8px 10px; background: #232b36; border-radius: 6px;
  font-size: 12px; color: #9ba5b0; margin-bottom: 10px;
  min-height: 34px; line-height: 1.5;
}
.budget-info.warn { background: #3a2e1a; color: #e0a020; }
.budget-info b { color: #e6e8eb; }
.budget-info.warn b { color: #f0c060; }

/* === Проекты === */
.projects { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.project-card {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 12px; background: #232b36; border-radius: 6px;
  border-left: 3px solid #4ec9b0; font-size: 13px; cursor: pointer;
  transition: background 0.15s, outline 0.1s; user-select: none;
}
.project-card:hover { background: #2d3743; }
.project-card.resource { border-left-color: #c586c0; }
.project-card.selected { background: #1e3a35; border-left-color: #4ec9b0; outline: 1px solid #4ec9b0; }
.project-card .name { font-weight: 600; color: #e6e8eb; }
.project-card .detail { font-size: 11px; color: #7a8590; margin-top: 2px; }
.project-card .cost { color: #e0a020; font-weight: 600; font-size: 14px; min-width: 44px; text-align: right; }

/* === Ресурсы === */
.resource-info {
  padding: 8px 10px; background: #232b36; border-radius: 6px;
  font-size: 12px; color: #9ba5b0; margin-bottom: 10px; line-height: 1.5;
}
.resource-info b { color: #e6e8eb; }
.rflow-sum {
  padding: 6px 10px; font-size: 12px; color: #9ba5b0;
  background: #232b36; border-radius: 6px; margin: 6px 0 12px;
}
.rflow-sum.over { color: #e05252; background: #3a1e1e; }

/* === Кнопка === */
.btn-primary {
  width: 100%; padding: 12px; background: #4ec9b0; color: #0f1419;
  border: none; border-radius: 6px; font-weight: 700; font-size: 14px;
  cursor: pointer; text-transform: uppercase; letter-spacing: 0.05em;
  transition: background 0.15s;
}
.btn-primary:hover { background: #6ee0ca; }
.btn-primary:disabled { background: #3a4248; color: #6a7580; cursor: not-allowed; }

/* === Судьба эмиссии === */
.fate-bar {
  display: flex; height: 40px; border-radius: 6px;
  overflow: hidden; margin-bottom: 10px;
  background: #232b36;
}
.fate-segment {
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: #0f1419;
  transition: flex-basis 0.4s; min-width: 0;
  overflow: hidden;
}
.fate-empty, .transit-empty, .delta-empty {
  color: #5a636d; font-size: 12px; font-style: italic;
  padding: 10px 0; text-align: center;
}
.fate-legend {
  display: flex; flex-wrap: wrap; gap: 12px;
  font-size: 11px; color: #9ba5b0; margin-bottom: 10px;
}
.fate-legend-item { display: inline-flex; align-items: center; gap: 5px; }
.fate-legend-item b { color: #e6e8eb; }
.fate-legend-item .dot {
  width: 10px; height: 10px; border-radius: 50%;
  display: inline-block;
}
.fate-return {
  padding: 10px 12px; background: #232b36; border-radius: 6px;
  font-size: 13px; margin-bottom: 8px;
  border-left: 3px solid #4ec9b0;
}
.fate-return.good   { border-left-color: #4ec9b0; color: #b4e8dc; }
.fate-return.warn   { border-left-color: #e0a020; color: #f0c060; }
.fate-return.danger { border-left-color: #e05252; color: #e08080; }
.fate-return b { color: #fff; }
.fate-extra {
  display: flex; gap: 16px; flex-wrap: wrap;
  font-size: 11px; color: #7a8590;
}
.fate-extra b { color: #e6e8eb; }

/* === Корзина цен === */
.basket {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
}
.basket-item {
  padding: 12px 8px; background: #232b36; border-radius: 6px;
  text-align: center;
}
.basket-item .name { font-size: 11px; color: #9ba5b0; text-transform: uppercase; letter-spacing: 0.05em; }
.basket-item .price { font-size: 20px; font-weight: 700; color: #e6e8eb; margin: 4px 0 0; }
.basket-item .unit  { font-size: 10px; color: #5a636d; }
.basket-item .change { font-size: 12px; font-weight: 600; margin-top: 4px; }
.basket-item .change.up   { color: #e05252; }
.basket-item .change.down { color: #4ec9b0; }
.basket-item .change.flat { color: #7a8590; }

/* === Транзит === */
.transit-list { display: flex; flex-direction: column; gap: 8px; }
.transit-item {
  padding: 8px 10px; background: #232b36; border-radius: 6px;
}
.transit-head {
  display: flex; justify-content: space-between;
  font-size: 12px; margin-bottom: 5px;
}
.transit-head .name { color: #e6e8eb; font-weight: 600; }
.transit-head .eta  { color: #7a8590; font-size: 11px; }
.transit-item .progress {
  height: 4px; background: #2d3743; border-radius: 2px; overflow: hidden;
}
.transit-item .progress-bar {
  height: 100%; background: #4ec9b0; border-radius: 2px;
  transition: width 0.4s;
}

/* === Графики === */
.charts {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.chart-wrap {
  background: #232b36; border-radius: 6px; padding: 10px;
  height: 200px; position: relative; overflow: hidden;
}
.chart-wrap canvas {
  width: 100% !important; height: 100% !important; display: block;
}

/* === Дельта === */
.delta-table { width: 100%; font-size: 12px; border-collapse: collapse; }
.delta-table td { padding: 7px 4px; border-bottom: 1px solid #2d3743; }
.delta-table td:first-child { color: #9ba5b0; }
.delta-table td:nth-child(2) { text-align: right; color: #7a8590; font-variant-numeric: tabular-nums; }
.delta-table td:nth-child(3) { text-align: right; color: #e6e8eb; font-weight: 600; font-variant-numeric: tabular-nums; }
.delta-table td:nth-child(4) { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.delta-table td.up      { color: #e05252; }
.delta-table td.down    { color: #4ec9b0; }
.delta-table td.neutral { color: #7a8590; }

/* === Лог === */
.log-content { font-size: 12px; line-height: 1.5; }
.log-entry {
  padding: 5px 8px; margin-bottom: 4px; border-radius: 4px;
  border-left: 3px solid #4ec9b0; background: #232b36;
}
.log-entry.warn   { border-left-color: #e0a020; color: #e0c070; }
.log-entry.danger { border-left-color: #e05252; color: #e08080; background: #2e1e1e; }
.log-entry.info   { border-left-color: #4ec9b0; }
.log-entry.header {
  background: transparent; border-left: none; color: #4ec9b0;
  font-weight: 700; text-transform: uppercase; font-size: 10px;
  letter-spacing: 0.05em; padding-top: 10px;
}

/* === Скроллбар === */
.panel::-webkit-scrollbar { width: 8px; }
.panel::-webkit-scrollbar-track { background: #1a2028; }
.panel::-webkit-scrollbar-thumb { background: #2d3743; border-radius: 4px; }
.panel::-webkit-scrollbar-thumb:hover { background: #3a4652; }

/* === Адаптив === */
@media (max-width: 1280px) {
  .main { grid-template-columns: 340px 1fr; }
  .delta-panel { grid-column: 1 / -1; max-height: 400px; }
}
@media (max-width: 900px) {
  .main { grid-template-columns: 1fr; }
  .controls, .delta-panel { max-height: none; }
  .charts { grid-template-columns: 1fr; }
  .header { grid-template-columns: 1fr; text-align: center; }
  .header-metrics { justify-content: center; }
}