/* ── Performance Tab ────────────────────────────────────────────────────
   Lives inside #history-drawer-body when #performance-container is shown.
   ──────────────────────────────────────────────────────────────────────── */

#performance-container {
  display: none;
  flex-direction: column;
  gap: 24px;
  padding: 8px 4px 40px;
  color: #d1d4dc;
}

/* Sticky topbar — sub-tabs, range pills, export ──────────────────────── */
#perf-topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 10px 8px;
  background: linear-gradient(180deg, rgba(13,16,20,0.96) 0%, rgba(13,16,20,0.85) 100%);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid #1f242c;
  border-radius: 8px 8px 0 0;
}
#perf-subtabs, #perf-ranges, #perf-scope {
  display: flex;
  gap: 4px;
  background: rgba(43, 49, 57, 0.4);
  padding: 3px;
  border-radius: 8px;
}
.perf-subtab, .perf-range, .perf-scope {
  background: transparent;
  border: none;
  color: #848e9c;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 5px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 160ms ease;
}
.perf-subtab:hover, .perf-range:hover, .perf-scope:hover { color: #d1d4dc; }
.perf-subtab.active, .perf-range.active, .perf-scope.active {
  background: linear-gradient(180deg, #2b3139 0%, #1f242c 100%);
  color: #fff;
  box-shadow: 0 1px 0 rgba(255,255,255,0.04) inset;
}
/* Scope pill stands out a touch — it's a higher-order choice than range */
#perf-scope { border: 1px solid rgba(240, 185, 11, 0.18); }
.perf-scope.active {
  background: linear-gradient(180deg, rgba(240, 185, 11, 0.18) 0%, rgba(240, 185, 11, 0.08) 100%);
  color: #f0b90b;
}
#perf-export {
  margin-left: auto;
  background: rgba(240, 185, 11, 0.08);
  border: 1px solid rgba(240, 185, 11, 0.35);
  color: #f0b90b;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 160ms ease;
}
#perf-export:hover {
  background: rgba(240, 185, 11, 0.16);
  transform: translateY(-1px);
}

/* KPI Hero Strip ──────────────────────────────────────────────────────── */
#perf-kpis {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
}
@media (max-width: 1100px) {
  #perf-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  #perf-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.kpi-card {
  position: relative;
  background: linear-gradient(135deg, rgba(43, 49, 57, 0.55) 0%, rgba(31, 36, 44, 0.45) 100%);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 14px 16px 6px;
  min-height: 122px;
  display: flex;
  flex-direction: column;
  box-shadow:
    0 1px 0 rgba(255,255,255,0.03) inset,
    0 4px 24px rgba(0,0,0,0.25);
  transition: transform 200ms ease, box-shadow 200ms ease, border-color 200ms ease;
  overflow: hidden;
}
.kpi-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255,255,255,0.12);
  box-shadow:
    0 1px 0 rgba(255,255,255,0.05) inset,
    0 8px 32px rgba(0,0,0,0.35);
}
.kpi-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #848e9c;
}
.kpi-value {
  margin-top: 6px;
  font-size: 24px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.01em;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}
.kpi-spark {
  margin-top: auto;
  width: 100% !important;
  height: 38px !important;
  display: block;
  opacity: 0.85;
}

/* Chart cards ─────────────────────────────────────────────────────────── */
.perf-chart {
  background: linear-gradient(180deg, rgba(31, 36, 44, 0.55) 0%, rgba(22, 26, 32, 0.45) 100%);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 18px 18px 14px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.18);
}
.perf-chart-title {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #d1d4dc;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.perf-chart canvas {
  width: 100% !important;
  height: 280px !important;
  display: block;
}
.perf-chart-hero {
  background: linear-gradient(180deg, rgba(14, 203, 129, 0.05) 0%, rgba(22, 26, 32, 0.55) 100%);
  border-color: rgba(14, 203, 129, 0.18);
}
.perf-chart-hero canvas { height: 360px !important; }

#perf-year-select {
  background: rgba(43, 49, 57, 0.6);
  border: 1px solid rgba(255,255,255,0.08);
  color: #d1d4dc;
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
}

/* Empty state ─────────────────────────────────────────────────────────── */
#perf-empty {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 20px;
  text-align: center;
  color: #848e9c;
}
#perf-empty img {
  width: 64px;
  height: 64px;
  opacity: 0.55;
  margin-bottom: 18px;
  filter: grayscale(0.4);
}
#perf-empty p {
  margin: 0 0 6px;
  font-size: 15px;
  font-weight: 600;
  color: #d1d4dc;
}
#perf-empty span {
  font-size: 12px;
  color: #6b7280;
}

/* Skeleton shimmer ────────────────────────────────────────────────────── */
@keyframes perfShimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
.perf-loading .kpi-value,
.perf-loading .kpi-spark,
.perf-loading .perf-chart canvas {
  background: linear-gradient(90deg,
    rgba(43, 49, 57, 0.4) 0%,
    rgba(60, 68, 78, 0.55) 50%,
    rgba(43, 49, 57, 0.4) 100%);
  background-size: 200% 100%;
  animation: perfShimmer 1.4s ease-in-out infinite;
  border-radius: 6px;
  color: transparent !important;
}
.perf-loading .kpi-value { min-height: 28px; }
