/* ===== Portfolio page styles ===== */

/* --- Profile tabs --- */
.profile-tabs {
  display: flex; gap: 0.5rem; margin-bottom: 1.5rem; justify-content: center;
}
.profile-tab {
  padding: 8px 20px; border-radius: 8px;
  font-size: 0.88rem; font-weight: 600;
  cursor: pointer; border: 1px solid var(--border);
  background: var(--surface); color: var(--text-muted);
  transition: all var(--transition); letter-spacing: 0.01em;
}
.profile-tab:hover { border-color: var(--accent); color: var(--text); }
.profile-tab.active {
  background: var(--accent); color: #fff; border-color: var(--accent);
}
[data-theme="dark"] .profile-tab.active { color: #0D1117; }

/* --- Alert banner --- */
.alert-banner {
  padding: 16px 20px; border-radius: var(--radius);
  font-size: 0.95rem; font-weight: 600; line-height: 1.6;
  border: 2px solid var(--red); background: var(--red-bg);
  color: var(--text); margin-bottom: 1.5rem;
  animation: alertPulse 2s ease-in-out;
}
.alert-banner.buy-alert { border-color: var(--green); background: var(--green-bg); }
.alert-banner .alert-action { display: block; margin-top: 4px; }
.alert-banner .alert-date { font-weight: 400; color: var(--text-muted); font-size: 0.85rem; }
@keyframes alertPulse {
  0% { opacity: 0; transform: translateY(-4px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* --- Action section --- */
.action-summary {
  padding: 12px 16px; border-radius: var(--radius);
  font-size: 0.92rem; font-weight: 600; margin-bottom: 1rem;
  border-left: 4px solid var(--accent); background: var(--accent-light); color: var(--text);
}
.action-summary.has-sell { border-left-color: var(--red); background: var(--red-bg); }
.action-summary.all-clear { border-left-color: var(--green); background: var(--green-bg); }

.action-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.action-table th {
  text-align: left; font-weight: 600; font-size: 0.78rem;
  text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--text-muted); padding: 8px 12px; border-bottom: 2px solid var(--border);
}
.action-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); }
.action-table tr:last-child td { border-bottom: none; }

.action-badge {
  display: inline-flex; align-items: center;
  padding: 4px 10px; border-radius: 6px;
  font-weight: 700; font-size: 0.8rem; letter-spacing: 0.02em;
}
.action-badge.sell { background: var(--red-bg); color: var(--red); }
.action-badge.buy { background: var(--green-bg); color: var(--green); }
.action-badge.hold { background: var(--accent-light); color: var(--accent); }
.action-badge.wait { background: var(--bg-alt); color: var(--text-muted); }

/* --- Metric cards --- */
.card-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.metric-card { text-align: center; }
.metric-label {
  font-size: 0.78rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--text-muted); margin-bottom: 0.35rem;
}
.metric-value {
  font-size: 1.35rem; font-weight: 700; color: var(--text);
  font-variant-numeric: tabular-nums;
}
.metric-value.green { color: var(--green); }
.metric-value.red { color: var(--red); }
.metric-hint {
  font-size: 0.72rem; color: var(--text-muted); margin-top: 0.35rem;
  line-height: 1.4; font-weight: 400;
}

/* --- Weights table --- */
.weights-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.weights-table th {
  text-align: left; font-weight: 600; font-size: 0.78rem;
  text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--text-muted); padding: 8px 12px; border-bottom: 2px solid var(--border);
}
.weights-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); font-variant-numeric: tabular-nums; }
.weights-table tr:last-child td { border-bottom: none; }

.weight-bar-wrap {
  width: 100%; height: 6px; background: var(--bg-alt); border-radius: 3px; overflow: hidden;
}
.weight-bar { height: 100%; border-radius: 3px; background: var(--accent); transition: width 0.4s ease; }

/* --- Charts --- */
canvas.port-chart {
  width: 100%; height: 360px; display: block;
  border-radius: var(--radius); background: var(--bg-alt); transition: background var(--transition);
}
canvas.dd-chart {
  width: 100%; height: 160px; display: block;
  border-radius: var(--radius); background: var(--bg-alt); transition: background var(--transition);
}
.port-legend {
  display: flex; gap: 16px; flex-wrap: wrap; margin-top: 0.75rem;
  font-size: 0.84rem; color: var(--text-muted);
}
.port-legend-item { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.port-swatch { width: 16px; height: 2px; border-radius: 4px; }
.port-swatch.portfolio { background: var(--green); }
.port-swatch.benchmark { background: var(--text-muted); }

/* --- Range buttons --- */
.range-btns { display: flex; gap: 0.35rem; margin-bottom: 0.75rem; }
.range-btn {
  padding: 4px 12px; border-radius: 6px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text-muted);
  font-size: 0.78rem; font-weight: 600; cursor: pointer; transition: all var(--transition);
}
.range-btn:hover { border-color: var(--accent); color: var(--text); }
.range-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
[data-theme="dark"] .range-btn.active { color: #0D1117; }

/* --- Responsive --- */
@media (max-width: 640px) {
  .card-grid.cols-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 520px) {
  canvas.port-chart { height: 260px; }
  canvas.dd-chart { height: 120px; }
  .port-legend { font-size: 0.8rem; gap: 10px; }
}
