body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  margin: 0;
  padding: 0;
  background: radial-gradient(circle at top, #e5e7eb 0, #d1d5db 45%, #9ca3af 100%);
  color: #0f172a;
}

header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(243, 244, 246, 0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid #d1d5db;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

header h1 {
  margin: 0;
  font-size: 20px;
  letter-spacing: 0.03em;
}

nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px; /* две строки вкладок без разрыва слов */
}

nav a {
  color: #4b5563;
  text-decoration: none;
  font-size: 14px;
  padding: 6px 10px;
  border-radius: 999px;
  transition: background 0.15s ease, color 0.15s ease, transform 0.1s ease;
  white-space: nowrap;
}

.user-info {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.user-info a {
  color: #2563eb;
  text-decoration: none;
  font-weight: 500;
}

.user-info a:hover {
  text-decoration: underline;
}

nav a:hover {
  color: #111827;
  background: rgba(209, 213, 219, 0.9);
  transform: translateY(-1px);
}

main {
  max-width: 1120px;
  margin: 24px auto 40px;
  padding: 0 16px;
}

section {
  margin-bottom: 24px;
  padding: 16px 20px;
  border-radius: 16px;
  background: radial-gradient(circle at top left, #f9fafb 0, #e5e7eb 60%);
  box-shadow:
    0 16px 32px rgba(15, 23, 42, 0.18),
    0 0 0 1px rgba(209, 213, 219, 0.9);
}

section h2 {
  margin-top: 0;
  font-size: 18px;
  margin-bottom: 10px;
}

.table-wrapper {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  border-radius: 12px;
  overflow: hidden;
}

th, td {
  border: 1px solid #e5e7eb;
  padding: 6px 10px;
  white-space: nowrap;
}

th {
  background: linear-gradient(to right, #e5e7eb, #d1d5db);
  font-weight: 600;
}

tr:nth-child(even) td {
  background: #f9fafb;
}

tr:nth-child(odd) td {
  background: #f3f4f6;
}

tr:hover td {
  background: #e5e7eb;
}

/* Корреляционная "тепловая карта" */
.corr-heatmap {
  table-layout: fixed;
}

/* отключаем полосатость/hover внутри тепловой карты,
   чтобы не перебивать цвета корреляций */
.corr-heatmap tr:nth-child(even) td,
.corr-heatmap tr:nth-child(odd) td,
.corr-heatmap tr:hover td {
  background: inherit;
}

.corr-cell {
  text-align: center;
  font-weight: 500;
  color: #111827;
}

.corr-high-pos {
  background: #bbf7d0 !important; /* ярко‑зелёный для сильной положительной связи */
}

.corr-mid-pos {
  background: #dcfce7 !important; /* мягкий зелёный */
}

.corr-low {
  background: #f9fafb !important; /* почти белый — слабая связь */
}

.corr-mid-neg {
  background: #fee2e2 !important; /* мягкий красный */
}

.corr-high-neg {
  background: #fecaca !important; /* ярко‑красный для сильной отрицательной связи */
}

.corr-image-wrapper {
  margin-bottom: 12px;
  overflow-x: auto;
}

.corr-image-wrapper img {
  display: block;
  height: auto;
  border-radius: 12px;
  box-shadow:
    0 12px 30px rgba(15, 23, 42, 0.25),
    0 0 0 1px rgba(209, 213, 219, 0.9);
}

button {
  border: none;
  border-radius: 999px;
  padding: 8px 16px;
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: #f9fafb;
  font-weight: 500;
  cursor: pointer;
  font-size: 14px;
  transition: transform 0.1s ease, box-shadow 0.1s ease, filter 0.1s ease;
}

button:hover {
  filter: brightness(1.05);
  box-shadow: 0 10px 24px rgba(34, 197, 94, 0.35);
  transform: translateY(-1px);
}

button:active {
  transform: translateY(0);
  box-shadow: 0 4px 10px rgba(34, 197, 94, 0.3);
}

input,
select {
  background: #f9fafb;
  border-radius: 999px;
  border: 1px solid #d1d5db;
  padding: 6px 10px;
  color: #111827;
  font-size: 13px;
  outline: none;
  min-width: 60px;
}

/* Узкий столбец "Валюта" в таблице портфеля */
input[name="currency"] {
  width: 72px;
  min-width: 72px;
  text-transform: uppercase;
  text-align: center;
}

/* Узкие числовые колонки в таблице портфеля */
input[name="quantity"] {
  width: 110px;
  min-width: 110px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

input[name="price"] {
  width: 110px;
  min-width: 110px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-right: 12px;
  margin-bottom: 8px;
  font-size: 13px;
}

.hint {
  font-size: 12px;
  color: #6b7280;
}

@media (max-width: 768px) {
  header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  nav a {
    margin-left: 0;
    margin-right: 8px;
    font-size: 13px;
  }

  section {
    padding: 14px 14px;
  }

  table {
    font-size: 11px;
  }

  input[name="currency"] {
    width: 60px;
    min-width: 60px;
  }

  input[name="quantity"],
  input[name="price"] {
    width: 90px;
    min-width: 90px;
  }
}


