/* ============================================
   Foliolytic Portfolio Tracker - Styles
   ============================================ */

/* Import Google Fonts for professional typography */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

* {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

body {
  background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
  color: #1e293b;
  line-height: 1.6;
}

/* Professional container styling */
.portfolio-container {
  background: white;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  border-radius: 12px;
  border: 1px solid #e2e8f0;
}

/* Enhanced table styling */
.table-wrapper {
  width: 100%;
  overflow-x: auto;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  background: white;
}

/* Sortable table header styles */
.sortable-header {
  cursor: pointer;
  user-select: none;
  position: relative;
  transition: background-color 0.2s ease;
}

.sortable-header:hover {
  background: linear-gradient(135deg, #5a6477 0%, #404859 100%);
}

.sortable-header::after {
  content: '';
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-bottom: 6px solid rgba(255, 255, 255, 0.4);
  opacity: 0.7;
}

.sortable-header.sort-asc::after {
  border-bottom: 6px solid rgba(255, 255, 255, 0.9);
  border-top: none;
  opacity: 1;
}

.sortable-header.sort-desc::after {
  border-top: 6px solid rgba(255, 255, 255, 0.9);
  border-bottom: none;
  opacity: 1;
}

.sortable-header.sort-active {
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
}

.portfolio-table {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  min-width: 1200px; /* Ensure minimum width for proper display */
}

.portfolio-table th {
  background: linear-gradient(135deg, #475569 0%, #334155 100%);
  color: white;
  font-weight: 600;
  font-size: 0.75rem; /* Reduced from 0.875rem */
  text-align: left;
  padding: 10px 8px; /* Reduced from 16px 12px */
  border-bottom: 2px solid #334155;
  vertical-align: top;
  line-height: 1.2;

  /* FIX: avoid conflict with sorting by removing header resize/cursor override */
  /* removed: resize: horizontal; cursor: col-resize; */
}

.portfolio-table td {
  padding: 8px; /* Reduced from 14px 12px */
  border-bottom: 1px solid #f1f5f9;
  font-size: 0.75rem; /* Reduced from 0.875rem */
  vertical-align: middle;
  white-space: nowrap;
}

.portfolio-table tbody tr:hover {
  background-color: #f8fafc;
  transition: background-color 0.2s ease;
}

.portfolio-table tbody tr:last-child td {
  border-bottom: none;
}

/* Totals row styling */
.totals-row {
  background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
  font-weight: 600;
  border-top: 2px solid #cbd5e1;
}

/* Flexible column width optimization with proper text handling */
.col-ticker { 
  width: 140px;
  min-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* initial max-width on the TDs only */
.portfolio-table td.col-ticker {
  max-width: 200px;
}
/* no cap on the TH so users can drag wider */
.portfolio-table th.col-ticker {
  max-width: none;
}

.col-shares            { width: 80px;   min-width: 60px; }
.col-avg-buy           { width: 80px;   min-width: 70px; }
.col-avg-sell          { width: 80px;   min-width: 70px; }
.col-total-invested    { width: 110px;  min-width: 90px; }
.col-total-invested-usd{ width: 100px;  min-width: 90px; }
.col-est-value         { width: 90px;   min-width: 80px; }
.col-gain-loss         { width: 90px;   min-width: 80px; }
.col-total-return      { width: 80px;   min-width: 70px; }
.col-unrealized-return { width: 90px;   min-width: 80px; }
.col-annualized        { width: 90px;   min-width: 80px; }
.col-curr-price        { width: 70px;   min-width: 60px; }
.col-curr-price-usd    { width: 85px;   min-width: 75px; }
.col-dividends         { width: 90px;  min-width: 80px; }

/* Make all table cells handle overflow properly */
.portfolio-table th,
.portfolio-table td {
  overflow: hidden;
  text-overflow: ellipsis;
  position: relative;
}

/* Professional input styling */
.price-input {
  border: 1px solid #d1d5db;
  border-radius: 4px;
  padding: 6px 8px;
  font-size: 0.75rem;
  background: white;
  width: 70px;
  text-align: center;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.price-input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Enhanced buttons */
.btn-primary {
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  color: white;
  padding: 12px 24px;
  border-radius: 8px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(59, 130, 246, 0.2);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(59, 130, 246, 0.3);
}

/* Update Cache button styling */
.btn-secondary {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  color: white;
  padding: 10px 20px;
  border-radius: 6px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(5, 150, 105, 0.2);
  font-size: 0.875rem;
}

.btn-secondary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(5, 150, 105, 0.3);
}

.btn-secondary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* File input styling */
.file-input {
  padding: 12px;
  border: 2px dashed #cbd5e1;
  border-radius: 8px;
  background: #f8fafc;
  transition: all 0.2s ease;
  cursor: pointer;
}

.file-input:hover {
  border-color: #3b82f6;
  background: #eff6ff;
}

/* Enhanced checkboxes (CONSOLIDATED SINGLE DEFINITION) */
.checkbox-container {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: white;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  transition: all 0.2s ease;
  cursor: pointer;
}
.checkbox-container:hover {
  border-color: #3b82f6;
  box-shadow: 0 2px 4px rgba(59, 130, 246, 0.1);
  background-color: #f8fafc;
}
.checkbox-container input[type="checkbox"] {
  accent-color: #3b82f6;
}

/* Color-coded values */
.positive-value {
  color: #059669;
  font-weight: 600;
}

.negative-value {
  color: #dc2626;
  font-weight: 600;
}

.neutral-value {
  color: #6b7280;
}

/* Professional title styling */
.main-title {
  background: linear-gradient(135deg, #1e293b 0%, #475569 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 700;
  font-size: 2.5rem;
  margin-bottom: 2rem;
}

/* Investor comparison chart styles */
.comparison-highlight {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  border: 2px solid #f59e0b;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 20px;
}

.user-performance-badge {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  padding: 8px 16px;
  border-radius: 20px;
  font-weight: 600;
  font-size: 0.875rem;
  display: inline-block;
  margin-bottom: 10px;
}

#chartStatus {
  font-style: italic;
  padding: 8px;
  background-color: #f8fafc;
  border-radius: 4px;
  border: 1px solid #e2e8f0;
}

#showMoreHoldings {
  font-size: 0.75rem;
  padding: 4px 8px;
  background: #f1f5f9;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
}

#showMoreHoldings:hover {
  background: #e2e8f0;
}

.section-title {
  color: #1e293b;
  font-weight: 600;
  font-size: 1.5rem;
  margin-bottom: 1rem;
}

/* Cache status styling */
.cache-status {
  font-size: 0.75rem;
  color: #6b7280;
  text-align: center;
  margin-top: 0.5rem;
}

/* Loading bar styles */
.loading-container {
  display: none;
  margin-top: 20px;
  padding: 20px;
  background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
  border-radius: 12px;
  border: 2px solid #cbd5e1;
}

.loading-container.active {
  display: block;
  animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

.loading-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.loading-spinner {
  width: 24px;
  height: 24px;
  border: 3px solid #e2e8f0;
  border-top: 3px solid #3b82f6;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.loading-title {
  font-size: 1rem;
  font-weight: 600;
  color: #1e293b;
}

.loading-status {
  font-size: 0.875rem;
  color: #64748b;
  margin-bottom: 12px;
  min-height: 21px;
  font-weight: 500;
}

.loading-bar-track {
  width: 100%;
  height: 8px;
  background: #e2e8f0;
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.loading-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6 0%, #2563eb 50%, #1d4ed8 100%);
  border-radius: 4px;
  transition: width 0.3s ease;
  position: relative;
  overflow: hidden;
}

.loading-bar-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.3) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.loading-percentage {
  font-size: 0.75rem;
  color: #475569;
  text-align: right;
  margin-top: 6px;
  font-weight: 600;
}

.pie-chart-layout {
  display: flex;
  gap: 40px;
  align-items: center;
  min-height: 700px;
  justify-content: center;
}

.pie-legend-list {
  flex: 0 0 350px;
  padding-right: 20px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.pie-legend-item {
  display: flex;
  align-items: center;
  margin-bottom: 6px;
  font-size: 0.875rem;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
}

.pie-legend-color {
  width: 16px;
  height: 16px;
  border-radius: 3px;
  margin-right: 12px;
  flex-shrink: 0;
}

.pie-legend-text {
  color: #374151;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.pie-chart-container {
  flex: 1;
  position: relative;
  height: 700px;
  display: flex;
  align-items: center;
  justify-content: center;

  /* CONSOLIDATED */
  overflow: visible !important;
}

/* CONSOLIDATED chart canvas sizing */
.pie-chart-container canvas {
  overflow: visible !important;
  width: 100% !important;
  height: 100% !important;
}

/* CONSOLIDATED specific chart sizing + subtle drop shadow */
#portfolioPieChart,
#netWorthPieChart {
  width: 100% !important;
  height: 100% !important;
  max-width: 950px;
  max-height: 950px;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: optimize-contrast;
  image-rendering: crisp-edges;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  filter: drop-shadow(2px 3px 5px rgba(0, 0, 0, 0.2)) contrast(1.1);
}

/* Net Worth Allocation input styling */
.net-worth-inputs {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  align-items: end;
  margin-bottom: 30px;
  padding: 20px;
  background: #f8fafc;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 200px;
}

.input-group label {
  font-weight: 600;
  color: #374151;
  font-size: 0.875rem;
}

.input-group input {
  padding: 12px 16px;
  border: 2px solid #d1d5db;
  border-radius: 8px;
  font-size: 0.875rem;
  background: white;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.input-group input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.input-group input::placeholder {
  color: #9ca3af;
}

#generateNetWorthChart {
  margin-left: auto;
  white-space: nowrap;
  height: fit-content;
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
  .pie-chart-layout {
    flex-direction: column;
    gap: 20px;
    min-height: auto;
    align-items: center;
  }
  
  .pie-legend-list {
    flex: none;
    padding-right: 0;
    order: 2;
    display: block;
    width: 100%;
    max-width: 400px;
  }
  
  .pie-chart-container {
    flex: none;
    height: 450px;
    order: 1;
  }
  
  #portfolioPieChart {
    max-width: 420px;
    max-height: 420px;
  }
  
  .pie-legend-item {
    font-size: 0.8rem;
    margin-bottom: 4px;
    white-space: nowrap;
  }
  
  .pie-legend-color {
    width: 14px;
    height: 14px;
    margin-right: 10px;
  }
  
  .pie-legend-text {
    font-size: 0.8rem;
  }

  .net-worth-inputs {
    flex-direction: column;
    align-items: stretch;
    gap: 15px;
  }
  
  .input-group {
    min-width: auto;
    width: 100%;
  }
  
  #generateNetWorthChart {
    margin-left: 0;
    margin-top: 10px;
  }

  .portfolio-table {
    min-width: 800px; /* Reduced for mobile but still scrollable */
  }
  
  .portfolio-table th,
  .portfolio-table td {
    padding: 6px 4px; /* Further reduced for mobile */
    font-size: 0.7rem; /* Smaller font on mobile */
  }
  
  .price-input {
    width: 50px; /* Smaller input fields */
    padding: 3px 4px;
    font-size: 0.7rem;
  }
  
  /* Adjust column widths for mobile */
  .col-ticker { width: 100px; min-width: 80px; }
  .col-shares { width: 60px; min-width: 50px; }
  .col-avg-buy { width: 70px; min-width: 60px; }
  .col-avg-sell { width: 70px; min-width: 60px; }
  .col-total-invested { width: 90px; min-width: 80px; }
  .col-total-invested-usd { width: 85px; min-width: 75px; }
  .col-est-value { width: 75px; min-width: 65px; }
  .col-gain-loss { width: 75px; min-width: 65px; }
  .col-total-return { width: 65px; min-width: 55px; }
  .col-unrealized-return { width: 70px; min-width: 60px; }
  .col-annualized { width: 65px; min-width: 55px; }
  .col-curr-price { width: 55px; min-width: 45px; }
  .col-curr-price-usd { width: 65px; min-width: 55px; }
  .col-dividends { width: 75px; min-width: 65px; }
  
  /* Mobile button adjustments */
  .btn-primary, .btn-secondary {
    padding: 10px 16px;
    font-size: 0.8rem;
  }
}

/* ========================================== */
/* INDIVIDUAL STOCK ANALYSIS STYLES          */
/* Ultra-Minimal (Stripe/Apple Style)        */
/* ========================================== */

.stock-button-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(95px, 1fr));
  gap: 6px;
  margin-bottom: 20px;
}

.stock-button {
  padding: 8px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: white;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
}

.stock-button:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.stock-button.active {
  background: #eff6ff;
  border-color: #3b82f6;
}

.stock-button.type-stock.active {
  background: #ecfdf5;
  border-color: #10b981;
}

.stock-button.type-crypto.active {
  background: #fef3c7;
  border-color: #f59e0b;
}

.stock-button-name {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 2px;
}

.stock-button-type {
  display: block;
  font-size: 9px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: #64748b;
}

.stock-button.type-stock .stock-button-type {
  color: #10b981;
}

.stock-button.type-crypto .stock-button-type {
  color: #f59e0b;
}

.stat-card {
  background: white;
  border-radius: 8px;
  padding: 16px;
  border: 1px solid #e5e7eb;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.stat-label {
  font-size: 13px;
  color: #6b7280;
  font-weight: 500;
  margin-bottom: 4px;
}

.stat-value {
  font-size: 20px;
  font-weight: 700;
  color: #1e293b;
}

.stat-value.positive {
  color: #10b981;
}

.stat-value.negative {
  color: #ef4444;
}

/* ============================================
   PORTFOLIO PERFORMANCE DASHBOARD - Dec 8
   ============================================ */

.perf-dashboard {
  margin-top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* ---------- Layout rows ---------- */

.perf-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.perf-row-secondary {
  margin-top: 0.5rem;
}

.perf-row-tertiary {
  margin-top: 0.5rem;
}

/* Common card style */

.perf-card {
  flex: 1 1 260px;
  background: #ffffff;
  border-radius: 0.75rem;
  border: 1px solid #e5e7eb;
  padding: 1rem 1.25rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

.perf-card-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.perf-card-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: #111827;
}

.perf-card-subtitle {
  font-size: 0.75rem;
  color: #6b7280;
}

.perf-card-body {
  font-size: 0.85rem;
  color: #111827;
}

.perf-card-body-compact {
  font-size: 0.8rem;
}

/* ---------- Top verdict block ---------- */

.perf-verdict-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.perf-verdict-main {
  flex: 1 1 280px;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.perf-verdict-title {
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #6b7280;
}

.perf-verdict-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
}

.perf-verdict-pill-text {
  font-size: 0.8rem;
  font-weight: 600;
}

.perf-verdict-sub {
  font-size: 0.8rem;
  color: #6b7280;
  max-width: 32rem;
}

.perf-verdict-metrics {
  flex: 1 1 260px;
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.perf-verdict-metric {
  min-width: 120px;
}

.perf-verdict-metric-label {
  font-size: 0.75rem;
  color: #6b7280;
  margin-bottom: 0.15rem;
}

.perf-verdict-metric-value {
  font-size: 1.3rem;
  font-weight: 700;
  color: #111827;
}

.perf-verdict-metric-sub {
  font-size: 0.75rem;
  color: #9ca3af;
}

/* ---------- Main headline numbers ---------- */

.perf-headline-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.perf-number-main {
  font-size: 1.4rem;
  font-weight: 700;
  color: #111827;
}

.perf-label-main {
  font-size: 0.8rem;
  color: #6b7280;
}

.perf-sub-main {
  font-size: 0.78rem;
  color: #9ca3af;
}

/* ---------- Generic metric grid ---------- */

.perf-metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.75rem 1.25rem;
  margin-top: 0.5rem;
}

.perf-metric-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
}

.perf-metric-label {
  font-size: 0.78rem;
  color: #6b7280;
}

.perf-metric-value {
  font-size: 0.95rem;
  font-weight: 600;
  color: #111827;
  margin-top: 0.15rem;
}

.perf-metric-value-large {
  font-size: 1.15rem;
  font-weight: 700;
  color: #111827;
}

.perf-metric-value-secondary {
  font-size: 0.85rem;
  font-weight: 500;
  color: #374151;
}

.perf-metric-hint {
  font-size: 0.72rem;
  color: #9ca3af;
  margin-top: 0.25rem;
}

/* Volatility / beta subrows */

.perf-subrow {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-top: 0.35rem;
  gap: 0.5rem;
}

.perf-sub-label {
  font-size: 0.75rem;
  color: #6b7280;
}

.perf-sub-value {
  font-size: 0.8rem;
  font-weight: 500;
  color: #111827;
}

.perf-metric-interpretation {
  font-size: 0.73rem;
  color: #9ca3af;
  margin-top: 0.4rem;
}

/* ---------- Tags & pills ---------- */

.perf-tag {
  display: inline-flex;
  align-items: center;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  border: 1px solid transparent;
}

.perf-tag-excellent {
  background: #ecfdf3;
  color: #15803d;
  border-color: #bbf7d0;
}

.perf-tag-good {
  background: #eff6ff;
  color: #1d4ed8;
  border-color: #bfdbfe;
}

.perf-tag-average {
  background: #f9fafb;
  color: #4b5563;
  border-color: #e5e7eb;
}

.perf-tag-below {
  background: #fffbeb;
  color: #92400e;
  border-color: #fed7aa;
}

.perf-tag-poor {
  background: #fef2f2;
  color: #b91c1c;
  border-color: #fecaca;
}

.perf-tag-neutral {
  background: #f3f4f6;
  color: #6b7280;
  border-color: #e5e7eb;
}

/* Verdict pills – color states */

.perf-pill-neutral {
  background: #f3f4f6;
  border-color: #e5e7eb;
  color: #111827;
}

.perf-pill-excellent {
  background: #ecfdf3;
  border-color: #bbf7d0;
  color: #166534;
}

.perf-pill-good {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1d4ed8;
}

.perf-pill-below {
  background: #fffbeb;
  border-color: #fed7aa;
  color: #92400e;
}

.perf-pill-poor {
  background: #fef2f2;
  border-color: #fecaca;
  color: #b91c1c;
}

/* ---------- Benchmark / compare bars ---------- */

.perf-benchmark-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 0.8rem;
  margin-top: 0.25rem;
}

.perf-benchmark-row-top {
  margin-top: 0.5rem;
}

.perf-benchmark-label {
  color: #6b7280;
}

.perf-benchmark-value {
  font-weight: 600;
  color: #111827;
}

.perf-benchmark-note {
  font-size: 0.7rem;
  color: #9ca3af;
  margin-top: 0.25rem;
}

.perf-compare-bar-wrapper {
  margin-top: 0.5rem;
}

.perf-compare-bar-label {
  font-size: 0.7rem;
  color: #9ca3af;
  margin-bottom: 0.25rem;
}

.perf-compare-bar {
  position: relative;
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, #e5e7eb, #cbd5f5);
  overflow: hidden;
}

.perf-compare-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #22c55e, #3b82f6);
  transition: width 0.25s ease-out;
}

.perf-compare-marker {
  position: absolute;
  top: 50%;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #111827;
  transform: translate(-50%, -50%);
}

.perf-compare-marker-label {
  position: absolute;
  top: 100%;
  transform: translateX(-50%);
  margin-top: 0.25rem;
  font-size: 0.7rem;
  white-space: nowrap;
  color: #6b7280;
}

/* ---------- Max drawdown block ---------- */

.perf-dd-main {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-top: 0.25rem;
}

.perf-dd-value {
  font-size: 1.1rem;
  font-weight: 700;
  color: #b91c1c;
}

.perf-dd-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.7rem;
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

.perf-dd-detail {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.6rem;
  align-items: center;
}

.perf-dd-arrow {
  font-size: 1.5rem;
  color: #9ca3af;
}

/* ---------- Responsiveness ---------- */

@media (max-width: 1024px) {
  .perf-verdict-row,
  .perf-headline-row,
  .perf-row {
    flex-direction: column;
  }

  .perf-verdict-metrics {
    flex-direction: row;
  }
}

@media (max-width: 640px) {
  .perf-card {
    padding: 0.85rem 0.9rem;
  }

  .perf-verdict-metric-value {
    font-size: 1.1rem;
  }

  .perf-number-main {
    font-size: 1.2rem;
  }
}

/* ============================================
   NEW HEADER & UPLOAD PANEL STYLES (Dec 2025)
   ============================================ */

/* Header Bar */
.site-header {
  background: white;
  border-bottom: 1px solid #e2e8f0;
  position: relative;
}

.header-inner {
  width: 100%;
  padding: 14px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-spacer {
  height: 20px;
}

/* Logo & Brand */
.header-logo {
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.header-logo:hover {
  transform: scale(1.02);
}

.logo-img {
  height: 52px;
  width: auto;
  flex-shrink: 0;
}

/* Header Right Section */
.header-right {
  display: flex;
  align-items: center;
}

.header-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.header-datetime {
  font-size: 11px;
  font-weight: 500;
  color: #64748b;
  text-align: right;
}

.header-time-text {
  font-size: 13px;
  font-weight: 600;
  color: #1e293b;
  letter-spacing: -0.2px;
}

/* Market Status Row */
/* Header Markets Section (Center) */
.header-markets {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.header-market-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.market-row-label {
  font-size: 10px;
  font-weight: 600;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  width: 70px;
  text-align: right;
  flex-shrink: 0;
}

.market-status-row {
  display: flex;
  gap: 6px;
}

.currency-status-row {
  display: flex;
  gap: 6px;
}

.currency-loading {
  font-size: 11px;
  color: #94a3b8;
  font-style: italic;
}

.market-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 7px;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.market-indicator.open {
  background: rgba(34, 197, 94, 0.08);
  border: 1px solid rgba(34, 197, 94, 0.2);
}

.market-indicator.closed {
  background: rgba(100, 116, 139, 0.05);
  border: 1px solid rgba(100, 116, 139, 0.1);
}

.market-indicator:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.market-flag {
  font-size: 10px;
}

.market-code {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.market-indicator.open .market-code {
  color: #16a34a;
}

.market-indicator.closed .market-code {
  color: #64748b;
}

.market-dot-wrapper {
  position: relative;
  width: 6px;
  height: 6px;
}

.market-dot-pulse {
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  background: #22c55e;
  opacity: 0.4;
  animation: market-pulse 1.5s ease-out infinite;
}

@keyframes market-pulse {
  0% { transform: scale(0.8); opacity: 0.6; }
  100% { transform: scale(2); opacity: 0; }
}

.market-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  position: relative;
}

.market-indicator.open .market-dot {
  background: #22c55e;
}

.market-indicator.closed .market-dot {
  background: #94a3b8;
}

/* Market Tooltip */
.market-tooltip {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: #1e293b;
  color: white;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  z-index: 1001;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  animation: tooltip-enter 0.2s ease;
  display: none;
  pointer-events: none;
}

.market-indicator:hover .market-tooltip {
  display: block;
}

.market-tooltip::before {
  content: '';
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-bottom: 6px solid #1e293b;
}

@keyframes tooltip-enter {
  from { opacity: 0; transform: translateX(-50%) translateY(4px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* Currency Indicators */
.currency-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 7px;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  background: rgba(100, 116, 139, 0.05);
  border: 1px solid rgba(100, 116, 139, 0.12);
  user-select: none;
}

.currency-indicator:active {
  transform: scale(0.97);
}

.currency-indicator:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.currency-flag {
  font-size: 10px;
}

.currency-code {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.3px;
  color: #475569;
}

.currency-value {
  font-size: 9px;
  font-weight: 500;
  color: #64748b;
  font-family: 'SF Mono', 'Monaco', 'Inconsolata', monospace;
}

.currency-change {
  font-size: 9px;
  font-weight: 600;
}

.currency-indicator.up .currency-change {
  color: #16a34a;
}

.currency-indicator.down .currency-change {
  color: #dc2626;
}

/* Currency Tooltip */
.currency-tooltip {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(30, 41, 59, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: white;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  z-index: 1001;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.08);
  animation: tooltip-enter 0.2s ease;
  display: none;
  pointer-events: none;
}

.currency-indicator:hover .currency-tooltip {
  display: block;
}

.currency-tooltip::before {
  content: '';
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-bottom: 6px solid #1e293b;
}

.currency-tooltip .tooltip-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}

.currency-tooltip .tooltip-header .flag {
  font-size: 14px;
}

.currency-tooltip .tooltip-header .name {
  font-weight: 600;
}

.currency-tooltip .tooltip-rate {
  color: #cbd5e1;
  margin-bottom: 4px;
}

.currency-tooltip .tooltip-rate strong {
  color: white;
  font-family: 'SF Mono', 'Monaco', 'Inconsolata', monospace;
}

.currency-tooltip .tooltip-change {
  font-weight: 600;
  margin-bottom: 4px;
}

.currency-tooltip .tooltip-change.up {
  color: #4ade80;
}

.currency-tooltip .tooltip-change.down {
  color: #f87171;
}

.currency-tooltip .tooltip-date {
  font-size: 10px;
  color: #94a3b8;
}

/* ============================================================================
   Currency Chart Modal
   ============================================================================ */

.currency-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 20px;
  animation: modalFadeIn 0.2s ease;
}

@keyframes modalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.currency-modal {
  background: white;
  border-radius: 20px;
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.3);
  max-width: 800px;
  width: 100%;
  max-height: 90vh;
  overflow: hidden;
  animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
  from { 
    opacity: 0;
    transform: translateY(20px) scale(0.98);
  }
  to { 
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.currency-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 28px;
  border-bottom: 1px solid #f1f5f9;
}

.currency-modal-title {
  display: flex;
  align-items: center;
  gap: 16px;
}

.currency-modal-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  background: rgba(59, 130, 246, 0.1);
}

.currency-modal-title-text h2 {
  font-size: 20px;
  font-weight: 700;
  color: #1e293b;
  margin: 0 0 4px 0;
}

.currency-modal-title-text p {
  font-size: 13px;
  color: #64748b;
  margin: 0;
}

.currency-modal-close {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #f1f5f9;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  transition: all 0.2s ease;
}

.currency-modal-close:hover {
  background: #e2e8f0;
  color: #1e293b;
}

.currency-modal-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  padding: 20px 28px;
  background: #f8fafc;
  border-bottom: 1px solid #f1f5f9;
}

.currency-stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.currency-stat-label {
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.currency-stat-value {
  font-size: 22px;
  font-weight: 700;
  color: #1e293b;
  font-family: 'SF Mono', 'Monaco', 'Inconsolata', monospace;
}

.currency-stat-value.positive {
  color: #16a34a;
}

.currency-stat-value.negative {
  color: #dc2626;
}

.currency-modal-chart {
  padding: 24px 28px;
  height: 320px;
}

.currency-modal-chart canvas {
  width: 100% !important;
  height: 100% !important;
}

.currency-modal-footer {
  padding: 16px 28px;
  background: #f8fafc;
  border-top: 1px solid #f1f5f9;
  text-align: center;
  font-size: 12px;
  color: #94a3b8;
}

/* Mobile responsive */
@media (max-width: 640px) {
  .currency-modal {
    border-radius: 16px;
    margin: 10px;
  }
  
  .currency-modal-header {
    padding: 20px;
  }
  
  .currency-modal-icon {
    width: 44px;
    height: 44px;
    font-size: 20px;
  }
  
  .currency-modal-title-text h2 {
    font-size: 17px;
  }
  
  .currency-modal-stats {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 16px 20px;
  }
  
  .currency-stat {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }
  
  .currency-stat-value {
    font-size: 18px;
  }
  
  .currency-modal-chart {
    padding: 16px 20px;
    height: 250px;
  }
}

.tooltip-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.tooltip-header .flag {
  font-size: 14px;
}

.tooltip-header .name {
  font-weight: 700;
}

.tooltip-status {
  display: flex;
  align-items: center;
  gap: 6px;
}

.tooltip-status.open {
  color: #4ade80;
}

.tooltip-status.closed {
  color: #94a3b8;
}

.tooltip-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.tooltip-status.open .tooltip-dot {
  background: #22c55e;
}

.tooltip-status.closed .tooltip-dot {
  background: #64748b;
}

/* Header Divider */
.header-divider {
  width: 1px;
  height: 40px;
  background: linear-gradient(180deg, transparent, #e2e8f0, transparent);
}

/* Header Buttons */
.header-buttons {
  display: flex;
  gap: 10px;
}

.btn-header {
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-header:hover {
  transform: translateY(-1px);
}

.btn-header:active {
  transform: translateY(0);
}

.btn-header-secondary {
  background: white;
  border: 1px solid #e2e8f0;
  color: #475569;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.btn-header-secondary:hover {
  border-color: #3b82f6;
  color: #3b82f6;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
}

.btn-header-primary {
  background: linear-gradient(135deg, #3b82f6 0%, #1e40af 100%);
  border: none;
  color: white;
  box-shadow: 0 2px 10px rgba(59, 130, 246, 0.3);
}

.btn-header-primary:hover {
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

/* ============================================
   UPLOAD PANEL STYLES
   ============================================ */

.upload-panel {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 20px;
  padding: 24px 28px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
  margin-bottom: 24px;
}

.upload-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.upload-panel-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.upload-icon-box {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #e2e8f0;
  transition: all 0.4s ease;
}

.upload-icon-box.success {
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
  border: none;
  animation: upload-glow-pulse 2s ease-in-out infinite;
}

@keyframes upload-glow-pulse {
  0%, 100% { box-shadow: 0 0 20px rgba(34, 197, 94, 0.3); }
  50% { box-shadow: 0 0 35px rgba(34, 197, 94, 0.5); }
}

.upload-icon-box.success svg {
  stroke: white;
}

.upload-icon-box .success-check {
  animation: success-pop 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes success-pop {
  0% { transform: scale(0.8); opacity: 0; }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); opacity: 1; }
}

.upload-panel-title {
  font-size: 17px;
  font-weight: 600;
  color: #1e293b;
  margin: 0;
}

.upload-panel-subtitle {
  font-size: 13px;
  color: #64748b;
  margin: 0;
}

/* Switch Portfolio Badge */
.switch-portfolio-badge {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(59, 130, 246, 0.08);
  border-radius: 8px;
  border: 1px solid rgba(59, 130, 246, 0.15);
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 12px;
  font-weight: 600;
  color: #3b82f6;
}

.switch-portfolio-badge.visible {
  display: flex;
}

.switch-portfolio-badge:hover {
  background: rgba(59, 130, 246, 0.12);
  border-color: rgba(59, 130, 246, 0.25);
}

/* Upload Drop Zone */
.upload-zone {
  position: relative;
  border: 2px dashed #d1d5db;
  border-radius: 16px;
  padding: 36px;
  background: linear-gradient(135deg, #fafbfc 0%, #f8fafc 100%);
  cursor: pointer;
  overflow: hidden;
  transition: all 0.25s ease;
}

.upload-zone:hover {
  border-color: #3b82f6;
  background: linear-gradient(135deg, #eff6ff 0%, #e0f2fe 100%);
}

.upload-zone.drag-active {
  border-color: #3b82f6;
  border-style: solid;
  background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
}

.upload-zone.has-file {
  padding: 20px;
}

/* Upload Zone Empty State */
.upload-zone-empty {
  text-align: center;
}

.upload-icon-container {
  position: relative;
  width: 76px;
  height: 76px;
  margin: 0 auto 16px;
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(59, 130, 246, 0.15);
}

.upload-icon-glow {
  display: none;
}

.upload-zone-title {
  font-size: 16px;
  font-weight: 600;
  color: #1e293b;
  margin: 0 0 6px 0;
}

.upload-zone-title.active {
  color: #3b82f6;
}

.upload-zone-subtitle {
  font-size: 14px;
  color: #64748b;
  margin: 0;
}

.upload-zone-subtitle .browse-link {
  color: #3b82f6;
  font-weight: 500;
  border-bottom: 1px dashed #3b82f6;
  padding-bottom: 1px;
}

/* Supported Types */
.upload-supported-types {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-top: 16px;
  color: #94a3b8;
  font-size: 12px;
}

.upload-supported-types span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.upload-supported-types .separator {
  color: #d1d5db;
}

/* File Card (when file uploaded) */
.upload-file-display {
  display: none;
  align-items: center;
  justify-content: center;
}

.upload-file-display.visible {
  display: flex;
}

.upload-file-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.file-icon-box {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #3b82f6 0%, #1e40af 100%);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.file-icon-box.success {
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
}

.file-info .file-name {
  font-size: 14px;
  font-weight: 600;
  color: #1e293b;
}

.file-info .file-size {
  font-size: 12px;
  color: #94a3b8;
}

/* New Loading Bar Styles */
.new-loading-container {
  margin-top: 20px;
  display: none;
}

.new-loading-container.active {
  display: block;
}

.new-loading-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 10px;
  position: relative;
}

.new-loading-left {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
}

.new-loading-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid #e2e8f0;
  border-top-color: #3b82f6;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.new-loading-status {
  font-size: 13px;
  font-weight: 500;
  color: #475569;
}

.new-loading-percent {
  font-size: 13px;
  font-weight: 700;
  color: #3b82f6;
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
}

.new-loading-track {
  height: 12px;
  background: #e2e8f0;
  border-radius: 6px;
  overflow: hidden;
  position: relative;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.new-loading-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0%;
  border-radius: 6px;
  background: linear-gradient(90deg, #2563eb 0%, #3b82f6 100%);
  transition: width 0.3s ease-out;
}

.new-loading-detail {
  margin-top: 14px;
  font-size: 12px;
  color: #64748b;
  text-align: center;
  min-height: 18px;
  font-style: italic;
  opacity: 0;
  transition: opacity 0.2s ease-in-out;
}

.new-loading-detail.active {
  opacity: 1;
}


/* Header responsive */
@media (max-width: 1200px) {
  .header-inner {
    padding: 12px 20px;
  }
  
  .header-right {
    gap: 16px;
  }
  
.logo-img {
    height: 38px;
  }
}

@media (max-width: 1200px) {
  .market-row-label {
    display: none;
  }
  
  .header-markets {
    gap: 4px;
  }
}

@media (max-width: 900px) {
  .header-markets {
    display: none;
  }
  
  .header-datetime {
    display: none;
  }
  
  .header-divider {
    display: none;
  }
}

@media (max-width: 640px) {
  .header-inner {
    padding: 10px 16px;
  }
  
.logo-img {
    height: 32px;
  }
  
  .header-buttons {
    gap: 6px;
  }
  
  .btn-header {
    padding: 8px 12px;
    font-size: 12px;
  }
  
  .btn-header span {
    display: none;
  }
}


/* ============================================
   PORTFOLIO PERFORMANCE - REDESIGNED (Dec 2025)
   ============================================ */

.perf-section {
  background: white;
  border-radius: 16px;
  border: 1px solid #e2e8f0;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  margin-bottom: 24px;
}

/* Header Row */
.perf-header {
  padding: 12px 16px;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.perf-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.perf-header-title {
  font-size: 15px;
  font-weight: 600;
  color: #1e293b;
  margin: 0;
}

/* Controls Row */
.perf-controls {
  padding: 10px 16px;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  background: #fafbfc;
  overflow: visible;
}

.perf-control-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.perf-control-label {
  font-size: 10px;
  font-weight: 600;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.perf-divider {
  width: 1px;
  height: 20px;
  background: #e2e8f0;
}

.perf-spacer {
  flex: 1;
}

/* Toggle Chip Buttons */
.perf-chip {
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid #e2e8f0;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  background: white;
  color: #64748b;
  position: relative;
}

.perf-chip:hover {
  border-color: #3b82f6;
  color: #3b82f6;
}

.perf-chip.active {
  background: #3b82f6;
  color: white;
  border-color: transparent;
}

.perf-chip.active-green {
  background: #10b981;
  color: white;
  border-color: transparent;
}

.perf-chip.active-orange {
  background: #f97316;
  color: white;
  border-color: transparent;
}

.perf-chip.active-purple {
  background: #8b5cf6;
  color: white;
  border-color: transparent;
}

.perf-chip.active-red {
  background: #ef4444;
  color: white;
  border-color: transparent;
}

.perf-chip-tooltip {
  position: fixed;
  background: #1e293b;
  color: white;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 500;
  white-space: normal;
  width: max-content;
  max-width: 240px;
  text-align: center;
  line-height: 1.4;
  box-shadow: 0 4px 20px rgba(0,0,0,0.25);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease, visibility 0.15s ease;
  z-index: 99999;
  pointer-events: none;
}

.perf-chip-tooltip::after {
  content: '';
  position: absolute;
  top: var(--arrow-top, 100%);
  left: 50%;
  transform: translateX(-50%);
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 6px solid #1e293b;
}

.perf-chip:hover .perf-chip-tooltip {
  opacity: 1;
  visibility: visible;
}

/* Holdings Dropdown */
.perf-holdings-dropdown {
  position: relative;
}

.perf-holdings-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 4px;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.15);
  min-width: 260px;
  z-index: 100;
  overflow: hidden;
  display: none;
}

.perf-holdings-menu.open {
  display: block;
}

.perf-holdings-search {
  padding: 10px;
  border-bottom: 1px solid #f1f5f9;
}

.perf-holdings-search-input {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 6px 10px;
}

.perf-holdings-search-input input {
  border: none;
  background: transparent;
  outline: none;
  font-size: 12px;
  color: #374151;
  width: 100%;
}

.perf-holdings-search-input input::placeholder {
  color: #9ca3af;
}

.perf-holdings-header {
  padding: 8px 12px;
  font-size: 10px;
  font-weight: 600;
  color: #94a3b8;
  text-transform: uppercase;
  border-bottom: 1px solid #f1f5f9;
  background: #fafbfc;
}

.perf-holdings-list {
  max-height: 240px;
  overflow-y: auto;
  padding: 4px;
}

.perf-holdings-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  color: #374151;
  transition: background 0.1s;
}

.perf-holdings-item:hover {
  background: #f8fafc;
}

.perf-holdings-item input {
  accent-color: #3b82f6;
  width: 14px;
  height: 14px;
}

.perf-holdings-ticker {
  font-weight: 600;
  min-width: 55px;
  color: #1e293b;
}

.perf-holdings-name {
  color: #9ca3af;
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.perf-holdings-empty {
  padding: 16px;
  text-align: center;
  color: #94a3b8;
  font-size: 12px;
}

/* Chart Area */
.perf-chart-area {
  padding: 20px;
  position: relative;
}

/* Chart canvas container */
.perf-chart-area .bg-white {
  padding: 16px;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

#performanceChart {
  border-radius: 8px;
}

/* Legend + Time Range Row */
.perf-legend-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 8px;
}

.perf-legend {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.perf-legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: #475569;
  font-weight: 500;
}

.perf-legend-line {
  width: 16px;
  height: 3px;
  border-radius: 2px;
}

/* Time Range Pills */
.perf-time-pills {
  display: flex;
  gap: 2px;
  background: #f1f5f9;
  padding: 3px;
  border-radius: 6px;
}

.perf-time-btn {
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  background: transparent;
  color: #64748b;
  transition: all 0.15s ease;
  letter-spacing: 0.3px;
  position: relative;
}

.perf-time-btn:hover {
  color: #1e293b;
}

.perf-time-btn.active {
  background: #1e293b;
  color: white;
}

.perf-time-btn .perf-chip-tooltip {
  bottom: calc(100% + 8px);
}

.perf-time-btn:hover .perf-chip-tooltip {
  opacity: 1;
  visibility: visible;
}

/* Stats Footer */
.perf-stats-footer {
  padding: 14px 20px;
  border-top: 1px solid #f1f5f9;
  display: flex;
  justify-content: center;
  gap: 40px;
  background: linear-gradient(to right, #fafbfc, white);
  overflow-x: auto;
  flex-wrap: wrap;
}

.perf-stat {
  text-align: center;
  cursor: help;
  position: relative;
}

.perf-stat-label {
  font-size: 9px;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}

.perf-stat-value {
  font-size: 18px;
  font-weight: 700;
  color: #1e293b;
}

.perf-stat-value.positive {
  color: #10b981;
}

.perf-stat-value.negative {
  color: #ef4444;
}

.perf-stat-value.blue {
  color: #3b82f6;
}

/* Stat Tooltips */
.perf-stat .perf-chip-tooltip {
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
}

.perf-stat:hover .perf-chip-tooltip {
  opacity: 1;
  visibility: visible;
}

/* Responsive */
@media (max-width: 900px) {
  .perf-controls {
    gap: 8px;
  }
  
  .perf-divider {
    display: none;
  }
  
  .perf-control-group {
    flex-wrap: wrap;
  }
  
  .perf-stats-footer {
    gap: 24px;
    padding: 12px 16px;
  }
  
  .perf-stat-value {
    font-size: 16px;
  }
}

@media (max-width: 640px) {
  .perf-header {
    flex-direction: column;
    gap: 10px;
    align-items: flex-start;
  }
  
  .perf-legend-row {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .perf-stats-footer {
    gap: 16px;
  }
  
  .perf-stat-value {
    font-size: 14px;
  }
}





/* ============================================
   END OF STYLES
   ============================================ */