* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, "Microsoft YaHei", sans-serif;
  background: #eef2f6;
}

/* ========== Layout ========== */
.app {
  min-height: 100vh;
  display: flex;
}

.mobile-header,
.mobile-menu-backdrop {
  display: none;
}

/* ========== Sidebar ========== */
.sidebar {
  width: 260px;
  background: #0b1b5a;
  color: #fff;
  padding: 24px 18px;
  flex-shrink: 0;
}

.logo {
  margin-bottom: 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  padding-bottom: 16px;
}

.logo h1 {
  margin: 0;
  font-size: 28px;
  letter-spacing: 1px;
}

.logo p {
  margin: 8px 0 0;
  opacity: 0.8;
  font-size: 14px;
}

.menu {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.menu-item {
  display: block;
  color: #fff;
  text-decoration: none;
  padding: 16px 14px;
  border-radius: 14px;
  opacity: 0.9;
  font-size: 20px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.menu-item.active {
  background: rgba(70, 120, 255, 0.35);
  opacity: 1;
}

.menu-item:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.10);
}

/* ========== Main ========== */
.main {
  flex: 1;
  padding: 22px;
  background: #ffffff;
  margin: 14px;
  border-radius: 12px;
  border: 1px solid #e6e8ee;
  overflow-y: auto;
}

.main.cluster-layout-lock {
  overflow: hidden;
}

.page {
  display: none;
}

.page.active {
  display: block;
}

#page-pipeline.cluster-layout-active.page.active {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 72px);
  min-height: calc(100vh - 72px);
  overflow: hidden;
}

#page-recommend.feature-layout-active.page.active {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 72px);
  min-height: calc(100vh - 72px);
  overflow: hidden;
}

/* ========== Page Header ========== */
.page-header {
  margin-bottom: 20px;
}

.page-title {
  margin: 0 0 6px;
  font-size: 32px;
  font-weight: 700;
  color: #111;
}

.page-subtitle {
  margin: 0;
  font-size: 15px;
  color: #6b7078;
}

/* ========== Cards ========== */
.card-row {
  display: flex;
  gap: 18px;
  align-items: stretch;
}

/* ========== Dashboard Layout ========== */
#page-dashboard {
  flex-direction: column;
  gap: 18px;
}

#page-dashboard.page.active {
  display: flex;
}

#page-dashboard .card-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
}

#page-dashboard .card {
  min-height: 160px;
}

.card {
  flex: 1;
  background: #fff;
  border: 1px solid #e6e8ee;
  border-radius: 16px;
  padding: 18px 20px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.06);
  min-height: 150px;
}

.card h3 {
  margin: 0 0 12px;
  color: #333;
  font-size: 18px;
}

.card.full-width {
  flex: none;
  width: 100%;
  margin-bottom: 20px;
}

.status-item {
  color: #6b7078;
  line-height: 2;
  font-size: 16px;
}

.status-item span {
  color: #333;
  font-weight: 600;
}

.feature-number {
  font-size: 56px;
  font-weight: 800;
  margin: 18px 0 6px;
  color: #7a3ff2;
}

.feature-desc {
  color: #777;
}

/* ========== Algorithm Section ========== */
.algo-section {
  margin-top: 20px;
  padding: 16px 18px 18px;
}

.section-title {
  margin: 0 0 12px;
  text-align: center;
  font-size: 20px;
  font-weight: 700;
  color: #3a3f45;
}

.section-heading {
  margin: 0 0 8px;
  font-size: 24px;
  font-weight: 700;
  color: #111;
}

.pill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 12px;
  justify-content: center;
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 14px;
  border-radius: 999px;
  background: #f7f8fb;
  border: 1px solid #e1e4eb;
  font-size: 13px;
  font-weight: 500;
  color: #4b5563;
  transition: all 0.2s ease;
}

.pill:hover {
  background: #eef2ff;
  border-color: #c7d2fe;
}

/* ========== Benchmark Section ========== */
.benchmark-section {
  margin-top: 18px;
  padding: 18px 20px;
}

.metric-row {
  display: flex;
  gap: 16px;
  margin-bottom: 20px;
}

.metric-row.four-col {
  margin-bottom: 0;
  margin-top: 20px;
}

.metric-card {
  flex: 1;
  background: #f7f8fb;
  border: 1px solid #e3e6ee;
  border-radius: 14px;
  padding: 14px 16px;
  text-align: center;
}

.metric-label {
  font-size: 14px;
  color: #6b7078;
  margin-bottom: 6px;
}

.metric-value {
  font-size: 24px;
  font-weight: 800;
  color: #111;
}

.chart-placeholder {
  height: 200px;
  border: 1px dashed #cfd4df;
  border-radius: 12px;
  background: #fafbfe;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #999;
  font-size: 16px;
}

.chart-placeholder.large {
  height: 280px;
}

/* ========== Dashboard Benchmark (RealWorld) ========== */
.benchmark-summary-section .summary-meta {
  font-size: 13px;
  color: #6b7280;
  margin-bottom: 12px;
}


.benchmark-impact-action {
  margin: 0 0 16px;
}
.benchmark-controls {
  display: grid;
  grid-template-columns: 1fr 1.2fr 1.4fr;
  gap: 12px;
  margin-bottom: 10px;
}

.benchmark-control {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.benchmark-control-label {
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
}

.benchmark-control-input {
  width: 100%;
  height: 36px;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  padding: 0 10px;
  background: #ffffff;
  color: #111827;
  font-size: 13px;
}

.summary-charts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  width: 100%;
}

.category-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  width: 100%;
  margin-bottom: 16px;
}

.category-stat-card {
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 12px 14px;
}

.category-stat-label {
  font-size: 13px;
  font-weight: 700;
  color: #334155;
  margin-bottom: 8px;
}

.category-stat-meta {
  font-size: 12px;
  color: #64748b;
  line-height: 1.7;
}

.benchmark-summary-section {
  box-sizing: border-box;
  align-self: stretch;
  width: 100%;
  margin: 4px 0 0;
  padding: 20px;
}

.chart-card {
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 6px 8px;
  height: 420px;
  display: flex;
  flex-direction: column;
}

.chart-title {
  font-size: 13px;
  font-weight: 600;
  color: #475569;
  margin-bottom: 8px;
}

.chart-card canvas {
  flex: 1;
  width: 100% !important;
  height: 100% !important;
}

.chart-fallback-table {
  overflow: auto;
  border-top: 1px solid #e5e7eb;
  margin-top: 8px;
  padding-top: 8px;
}

.chart-fallback-table table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.chart-fallback-table th,
.chart-fallback-table td {
  padding: 6px 8px;
  border-bottom: 1px solid #e5e7eb;
  text-align: left;
  color: #334155;
}

.chart-fallback-table th {
  color: #64748b;
  font-weight: 700;
  background: #f8fafc;
  position: sticky;
  top: 0;
}

@media (max-width: 960px) {
  .benchmark-summary-section {
    width: 100%;
  }

  .benchmark-controls {
    grid-template-columns: 1fr;
  }

  .summary-charts {
    grid-template-columns: 1fr;
  }

  .chart-card {
    height: clamp(320px, 56vh, 560px);
  }
}

.table-wrapper {
  overflow-x: auto;
}

.benchmark-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.benchmark-table th,
.benchmark-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #e5e7eb;
  text-align: left;
  vertical-align: top;
}

.benchmark-table th {
  color: #64748b;
  font-weight: 600;
}

.benchmark-table td {
  color: #1f2937;
}

.benchmark-table .metric-pair {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 12px;
  color: #475569;
}

.benchmark-table .metric-pair span strong {
  color: #111827;
}

/* ========== Stepper - Square (Pipeline) ========== */
.stepper-card {
  height: 136px;
  min-height: 136px;
  max-height: 136px;
  flex: 0 0 136px;
  padding: 24px 30px;
  margin-bottom: 20px;
}

.stepper {
  display: flex;
  align-items: flex-start;
}

.stepper.stepper-circle {
  justify-content: space-between;
  width: 100%;
}

.stepper.stepper-square {
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
}

.stepper-square .step {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1 1 0;
  min-width: 140px;
  width: 0;
}

.stepper-square .step:last-child {
  flex: 1 1 0;
}

.stepper-square .step-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: #f0f2f5;
  border: 2px solid #e1e4eb;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #9ca3af;
  position: relative;
  z-index: 2;
  transition: all 0.3s ease;
}

.stepper-square .step-icon svg {
  width: 26px;
  height: 26px;
}

.stepper-square .step.active .step-icon {
  background: #3b82f6;
  border-color: #3b82f6;
  color: #fff;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.stepper-square .step.completed .step-icon {
  background: #3b82f6;
  border-color: #3b82f6;
  color: #fff;
}


.stepper-square .step-label {
  margin-top: 10px;
  font-size: 14px;
  font-weight: 600;
  color: #9ca3af;
  text-align: center;
  white-space: nowrap;
}

.stepper-square .step.active .step-label {
  color: #3b82f6;
}

.stepper-square .step.completed .step-label {
  color: #3b82f6;
}

/* ========== Stepper - Circle (Recommend) ========== */
.stepper-circle .step {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1 1 0;
  min-width: 0;
  position: relative;
}

.stepper-circle .step:last-child {
  flex: 1 1 0;
}

.stepper-circle .step-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid #e1e4eb;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #9ca3af;
  position: relative;
  z-index: 2;
  transition: all 0.3s ease;
}

.stepper-circle .step-icon svg {
  width: 24px;
  height: 24px;
}

.stepper-circle .step.active .step-icon {
  background: #3b82f6;
  border-color: #3b82f6;
  color: #fff;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.stepper-circle .step.completed .step-icon {
  background: #3b82f6;
  border-color: #3b82f6;
  color: #fff;
}

.stepper-circle .step-arrow {
  position: absolute;
  top: 16px;
  left: calc(50% + 36px);
  right: calc(-50% + 36px);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ef4444;
  font-size: 20px;
  z-index: 1;
}

.stepper-circle .step:last-child .step-arrow {
  display: none;
}

.stepper-circle .step-label {
  margin-top: 10px;
  font-size: 14px;
  font-weight: 600;
  color: #9ca3af;
  text-align: center;
  white-space: normal;
  max-width: 120px;
  line-height: 1.2;
}

.stepper-circle .step.active .step-label {
  color: #3b82f6;
}

.stepper-circle .step.completed .step-label {
  color: #3b82f6;
}

/* ========== Step Content ========== */
.pipeline-content,
.recommend-content {
  margin-bottom: 20px;
}

#page-pipeline.cluster-layout-active .pipeline-content {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  margin-bottom: 18px;
}

#page-recommend.feature-layout-active .recommend-content {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  margin-bottom: 18px;
}

.step-content {
  display: none;
  gap: 20px;
}

.step-content.active {
  display: flex;
  flex-wrap: wrap;
}

#page-pipeline .step-content[data-step="3"] {
  align-items: stretch;
}

#page-pipeline .step-content[data-step="2"] {
  align-items: stretch;
}

#page-pipeline .step-content[data-step="4"] {
  align-items: stretch;
}

#page-pipeline .step-content[data-step="5"] {
  align-items: stretch;
}

#page-pipeline.cluster-layout-active .step-content[data-step="2"].active,
#page-pipeline.cluster-layout-active .step-content[data-step="3"].active,
#page-pipeline.cluster-layout-active .step-content[data-step="4"].active,
#page-pipeline.cluster-layout-active .step-content[data-step="5"].active {
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  gap: 18px;
}

#page-pipeline.cluster-layout-active .step-content[data-step="2"].active,
#page-pipeline.cluster-layout-active .step-content[data-step="4"].active,
#page-pipeline.cluster-layout-active .step-content[data-step="5"].active {
  flex-wrap: nowrap;
}

#cluster-config-panel,
#cluster-result-panel {
  padding: 14px 16px;
}

#page-pipeline.cluster-layout-active #cluster-config-panel,
#page-pipeline.cluster-layout-active #cluster-result-panel,
#page-pipeline.cluster-layout-active #feature-config-panel,
#page-pipeline.cluster-layout-active #feature-result-panel,
#page-pipeline.cluster-layout-active #labeling-config-panel,
#page-pipeline.cluster-layout-active #labeling-result-panel,
#page-pipeline.cluster-layout-active #modelrace-config-panel,
#page-pipeline.cluster-layout-active #modelrace-result-panel {
  height: 100%;
  min-height: 0;
}

#page-pipeline.cluster-layout-active #feature-config-panel,
#page-pipeline.cluster-layout-active #feature-result-panel,
#page-pipeline.cluster-layout-active #labeling-config-panel,
#page-pipeline.cluster-layout-active #labeling-result-panel,
#page-pipeline.cluster-layout-active #modelrace-config-panel,
#page-pipeline.cluster-layout-active #modelrace-result-panel {
  min-width: 0;
}

#page-pipeline.cluster-layout-active #cluster-config-panel,
#page-pipeline.cluster-layout-active #feature-config-panel,
#page-pipeline.cluster-layout-active #labeling-config-panel,
#page-pipeline.cluster-layout-active #modelrace-config-panel {
  display: flex;
  flex-direction: column;
}

#cluster-config-panel .panel-title,
#cluster-result-panel .panel-title {
  margin-bottom: 6px;
}

#cluster-config-panel .panel-desc {
  margin-bottom: 10px;
  line-height: 1.35;
}

/* ========== Panels ========== */
.upload-panel,
.preview-panel,
.param-panel,
.result-panel {
  flex: 1;
  min-width: 45%;
}

.fixed-scroll-panel {
  display: flex;
  flex-direction: column;
  height: min(720px, 72vh);
  min-height: 460px;
}

.cluster-param-stack {
  flex-direction: column;
  gap: 10px;
}

.cluster-param-stack .param-group {
  width: 100%;
}

#cluster-config-panel .param-label {
  margin-bottom: 6px;
}

#cluster-config-panel .param-input {
  padding: 10px 12px;
}

#cluster-config-panel .param-hint {
  margin-top: 4px;
}

#cluster-config-panel .btn {
  margin-top: 2px;
}

#cluster-result-panel {
  min-height: 0;
}

#cluster-result-panel .result-placeholder {
  min-height: 110px;
}

#page-pipeline.cluster-layout-active .console-panel {
  flex: 0 0 auto;
}

#page-pipeline.cluster-layout-active #feature-config-panel {
  overflow-y: auto;
  overflow-x: hidden;
  padding: 14px 16px;
}

#page-pipeline.cluster-layout-active #feature-result-panel {
  height: 100%;
}

#page-pipeline.cluster-layout-active #labeling-config-panel,
#page-pipeline.cluster-layout-active #labeling-result-panel {
  padding: 14px 16px;
}

#page-pipeline.cluster-layout-active #labeling-config-panel {
  overflow-y: auto;
  overflow-x: hidden;
  flex: 0 0 calc(50% - 9px);
  max-width: calc(50% - 9px);
}

#page-pipeline.cluster-layout-active #labeling-result-panel {
  flex: 1 1 calc(50% - 9px);
  max-width: calc(50% - 9px);
}

#page-pipeline.cluster-layout-active #labeling-config-panel .panel-title,
#page-pipeline.cluster-layout-active #labeling-result-panel .panel-title {
  margin-bottom: 6px;
  font-size: 20px;
}

#page-pipeline.cluster-layout-active #labeling-config-panel .panel-desc {
  margin-bottom: 10px;
  line-height: 1.35;
  font-size: 15px;
}

#page-pipeline.cluster-layout-active #labeling-config-panel .param-label {
  margin-bottom: 10px;
  font-size: 15px;
}

#page-pipeline.cluster-layout-active #labeling-config-panel .checkbox-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  align-content: center;
  gap: 10px 12px;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px 14px;
  margin-bottom: 8px;
}

#page-pipeline.cluster-layout-active #labeling-config-panel .checkbox-item {
  width: fit-content;
  max-width: 100%;
  padding: 2px 0;
  border: none;
  border-radius: 0;
  background: transparent;
  font-size: 15px;
}

#page-pipeline.cluster-layout-active #labeling-config-panel .checkbox-item span {
  font-weight: 500;
}

#page-pipeline.cluster-layout-active #labeling-config-panel .checkbox-item input {
  width: 18px;
  height: 18px;
}

#page-pipeline.cluster-layout-active #labeling-config-panel .btn {
  margin-top: auto;
}

#page-pipeline.cluster-layout-active #labeling-results {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 4px;
}

#page-pipeline.cluster-layout-active #labeling-results .result-item {
  flex-shrink: 0;
}

#page-pipeline.cluster-layout-active #modelrace-config-panel,
#page-pipeline.cluster-layout-active #modelrace-result-panel {
  padding: 14px 16px;
}

#page-pipeline.cluster-layout-active #modelrace-config-panel {
  flex: 0 0 calc(50% - 9px);
  max-width: calc(50% - 9px);
  overflow-y: auto;
  overflow-x: hidden;
}

#page-pipeline.cluster-layout-active #modelrace-result-panel {
  flex: 1 1 calc(50% - 9px);
  max-width: calc(50% - 9px);
}

#page-pipeline.cluster-layout-active #modelrace-config-panel .panel-title,
#page-pipeline.cluster-layout-active #modelrace-result-panel .panel-title {
  margin-bottom: 6px;
}

#page-pipeline.cluster-layout-active #modelrace-config-panel .panel-desc {
  margin-bottom: 10px;
  line-height: 1.35;
}

.modelrace-param-stack {
  flex-direction: column;
  gap: 10px;
}

.modelrace-param-stack .param-group {
  width: 100%;
}

#page-pipeline.cluster-layout-active #modelrace-config-panel .param-input {
  padding: 10px 12px;
}

#page-pipeline.cluster-layout-active #modelrace-config-panel .btn {
  margin-top: 12px;
  position: sticky;
  bottom: 0;
  z-index: 1;
}

#page-pipeline.cluster-layout-active #modelrace-results {
  flex: 0 0 auto;
}

#page-pipeline.cluster-layout-active #pipeline-evolution-container {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 4px;
}

#page-pipeline.cluster-layout-active .evolution-table-wrapper {
  overflow-y: auto;
  max-height: none;
}

#page-pipeline.cluster-layout-active #feature-config-panel::-webkit-scrollbar,
#page-pipeline.cluster-layout-active #feature-results-container::-webkit-scrollbar,
#page-pipeline.cluster-layout-active #labeling-config-panel::-webkit-scrollbar,
#page-pipeline.cluster-layout-active #labeling-results::-webkit-scrollbar,
#page-pipeline.cluster-layout-active #labeling-config-panel .checkbox-grid::-webkit-scrollbar,
#page-pipeline.cluster-layout-active #pipeline-evolution-container::-webkit-scrollbar {
  width: 8px;
}

#page-pipeline.cluster-layout-active #feature-config-panel::-webkit-scrollbar-thumb,
#page-pipeline.cluster-layout-active #feature-results-container::-webkit-scrollbar-thumb,
#page-pipeline.cluster-layout-active #labeling-config-panel::-webkit-scrollbar-thumb,
#page-pipeline.cluster-layout-active #labeling-results::-webkit-scrollbar-thumb,
#page-pipeline.cluster-layout-active #labeling-config-panel .checkbox-grid::-webkit-scrollbar-thumb,
#page-pipeline.cluster-layout-active #pipeline-evolution-container::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 999px;
}

#page-pipeline.cluster-layout-active #feature-config-panel::-webkit-scrollbar-track,
#page-pipeline.cluster-layout-active #feature-results-container::-webkit-scrollbar-track,
#page-pipeline.cluster-layout-active #labeling-config-panel::-webkit-scrollbar-track,
#page-pipeline.cluster-layout-active #labeling-results::-webkit-scrollbar-track,
#page-pipeline.cluster-layout-active #labeling-config-panel .checkbox-grid::-webkit-scrollbar-track,
#page-pipeline.cluster-layout-active #pipeline-evolution-container::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 999px;
}

#cluster-results .result-item {
  padding: 12px 14px;
  flex-shrink: 0;
}

#labeling-results > .result-item {
  /* Match a collapsed cluster card: 36px summary + 12px top/bottom padding + borders. */
  height: 62px;
  min-height: 62px;
  max-height: 62px;
  flex: 0 0 62px;
  padding: 12px 14px;
}

#cluster-results .cluster-result-item,
#cluster-results .cluster-summary,
#cluster-results .cluster-preview-wrap,
#cluster-results .cluster-preview-plot {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.fixed-scroll-panel .panel-title {
  flex: 0 0 auto;
}

.fixed-scroll-panel .result-placeholder {
  flex: 1 1 auto;
  min-height: 0;
}

#cluster-results,
#feature-results-container,
#recommend-feature-results-container {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 4px;
}

#feature-results-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

#feature-results-container .feature-summary,
#feature-results-container .extractor-cards {
  margin-bottom: 0;
}

#feature-results-container .feature-preview-panel {
  margin-top: 0;
}

#cluster-results {
  justify-content: flex-start;
  align-items: stretch;
}

#cluster-results::-webkit-scrollbar,
#feature-results-container::-webkit-scrollbar,
#recommend-feature-results-container::-webkit-scrollbar {
  width: 8px;
}

#cluster-results::-webkit-scrollbar-thumb,
#feature-results-container::-webkit-scrollbar-thumb,
#recommend-feature-results-container::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 999px;
}

#cluster-results::-webkit-scrollbar-track,
#feature-results-container::-webkit-scrollbar-track,
#recommend-feature-results-container::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 999px;
}

.panel-title {
  margin: 0 0 8px;
  font-size: 18px;
  font-weight: 700;
  color: #333;
}

.panel-desc {
  margin: 0 0 16px;
  font-size: 14px;
  color: #6b7078;
  line-height: 1.5;
}


/* ========== Upload Zone ========== */
.upload-zone {
  border: 2px dashed #d1d5db;
  border-radius: 12px;
  padding: 50px 20px;
  text-align: center;
  cursor: pointer;
  background: #fafbfc;
  margin-bottom: 16px;
  transition: all 0.2s ease;
}

.upload-zone:hover {
  border-color: #3b82f6;
  background: #f0f7ff;
}

.upload-zone.dragover {
  border-color: #3b82f6;
  background: #e8f2ff;
}

.upload-zone.has-files {
  border-style: solid;
  border-color: #10b981;
  background: #f0fdf4;
}

.upload-icon svg {
  width: 48px;
  height: 48px;
  color: #9ca3af;
}

.upload-zone:hover .upload-icon svg {
  color: #3b82f6;
}

.upload-text {
  margin: 12px 0 4px;
  font-size: 15px;
  color: #4b5563;
}

.upload-hint {
  margin: 0;
  font-size: 13px;
  color: #9ca3af;
}

/* ========== File List ========== */
.file-list {
  margin-bottom: 16px;
}

.file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: #f7f8fb;
  border: 1px solid #e3e6ee;
  border-radius: 8px;
  margin-bottom: 8px;
}

.file-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.file-icon {
  width: 32px;
  height: 32px;
  background: #e0e7ff;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #4f46e5;
}

.file-name {
  font-size: 14px;
  font-weight: 500;
  color: #333;
}

.file-size {
  font-size: 12px;
  color: #9ca3af;
}

.file-remove {
  border: none;
  background: transparent;
  color: #9ca3af;
  cursor: pointer;
  padding: 4px;
  font-size: 16px;
}

.file-remove:hover {
  color: #ef4444;
}

/* ========== Preview ========== */
.preview-placeholder {
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.preview-placeholder span {
  font-size: 20px;
  font-weight: 600;
  color: #d1d5db;
}

.preview-stats {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.pipeline-preview-stats {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
  align-items: stretch;
}

.pipeline-stat-card {
  border: 1px solid #bfdbfe;
  background: #f0f7ff;
  border-radius: 8px;
  min-height: 52px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pipeline-stat-value {
  font-size: 13px;
  color: #1e40af;
  font-weight: 600;
}

.pipeline-stat-selector {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  justify-content: stretch;
  gap: 8px;
}

.pipeline-stat-selector label {
  color: #1e3a8a;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.pipeline-series-select {
  width: 100%;
  min-width: 0;
  border: 1px solid #93c5fd;
  border-radius: 6px;
  background: #ffffff;
  color: #1f2937;
  font-size: 13px;
  padding: 6px 10px;
}

@media (max-width: 900px) {
  .pipeline-preview-stats {
    grid-template-columns: 1fr;
  }
}

.stat-badge {
  padding: 6px 12px;
  background: #f0f7ff;
  border: 1px solid #bfdbfe;
  border-radius: 6px;
  font-size: 13px;
  color: #1e40af;
}

.preview-table-wrapper {
  max-height: 180px;
  overflow: auto;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
}

.preview-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.preview-table th {
  background: #f9fafb;
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
  color: #374151;
  border-bottom: 1px solid #e5e7eb;
  position: sticky;
  top: 0;
}

.preview-table td {
  padding: 8px 12px;
  border-bottom: 1px solid #f3f4f6;
  color: #4b5563;
}

/* ========== Parameters ========== */
.param-row {
  display: flex;
  gap: 20px;
  margin-bottom: 20px;
}

.param-row.three-col .param-group {
  flex: 1;
}

.param-group {
  flex: 1;
}

.param-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 8px;
}

.param-input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 15px;
  color: #333;
  background: #fff;
  transition: border-color 0.2s;
}

.param-input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.param-hint {
  display: block;
  font-size: 12px;
  color: #9ca3af;
  margin-top: 6px;
}

/* ========== Checkbox ========== */
.checkbox-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin-bottom: 20px;
  padding: 16px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
}

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 14px;
  color: #4b5563;
}

.checkbox-item input {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.algo-ref-label {
  position: relative;
  cursor: pointer;
  text-decoration: underline dotted;
  text-underline-offset: 2px;
}

.algo-ref-label:hover,
.algo-ref-label:focus-visible {
  color: #1d4ed8;
}

.algo-ref-label::after {
  content: attr(data-ref-title) " | " attr(data-ref-url);
  position: absolute;
  left: 0;
  bottom: calc(100% + 8px);
  display: none;
  width: 360px;
  max-width: 75vw;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid #1d4ed8;
  background: #eff6ff;
  color: #1e3a8a;
  font-size: 12px;
  line-height: 1.4;
  white-space: normal;
  z-index: 30;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
  pointer-events: none;
}

.algo-ref-label::before {
  content: '';
  position: absolute;
  left: 10px;
  bottom: calc(100% + 2px);
  display: none;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 6px solid #1d4ed8;
  z-index: 31;
}

.algo-ref-label:hover::after,
.algo-ref-label:hover::before,
.algo-ref-label:focus-visible::after,
.algo-ref-label:focus-visible::before {
  display: block;
}

.checkbox-item.large {
  padding: 12px 16px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  margin-bottom: 10px;
}

.checkbox-item.large span {
  font-size: 16px;
  font-weight: 500;
}

.feature-checkbox-list {
  margin-bottom: 20px;
}

/* ========== Results ========== */
.result-placeholder {
  min-height: 150px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.result-placeholder span {
  font-size: 16px;
  color: #d1d5db;
}

.result-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.result-item {
  display: flex;
  align-items: center;
  padding: 14px 18px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
}

.result-item:hover {
  background: #f3f4f6;
}

.cluster-result-item {
  padding: 0;
  display: block;
  flex: 0 0 auto;
  overflow: hidden;
}

.cluster-summary {
  width: 100%;
  display: flex;
  align-items: center;
  border: none;
  outline: none;
  background: transparent;
  box-sizing: border-box;
  height: 36px;
  min-height: 36px;
  max-height: 36px;
  padding: 0 18px;
  flex: 0 0 36px;
  flex-shrink: 0;
  cursor: pointer;
  text-align: left;
}

.cluster-summary:hover {
  background: #f3f4f6;
}

.cluster-toggle {
  margin-left: 10px;
  color: #64748b;
  font-size: 12px;
  transition: transform 0.2s ease;
}

.cluster-result-item.expanded .cluster-toggle {
  transform: rotate(180deg);
}

.cluster-preview-wrap {
  display: none;
  padding: 0 18px 14px;
}

.cluster-result-item.expanded .cluster-preview-wrap {
  display: block;
}

.cluster-preview-meta {
  margin: 4px 0 8px;
  font-size: 12px;
  color: #64748b;
}

.cluster-preview-plot {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
  padding: 6px;
}

.cluster-preview-svg {
  display: block;
  width: 100%;
  height: 120px;
}

.cluster-preview-axis {
  stroke: #e2e8f0;
  stroke-width: 1;
}

.cluster-preview-grid {
  stroke: #eef2f7;
  stroke-width: 1;
}

.cluster-preview-line {
  fill: none;
  stroke: #2563eb;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.cluster-preview-tick-label {
  fill: #64748b;
  font-size: 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.cluster-preview-axis-label {
  fill: #475569;
  font-size: 11px;
  font-weight: 600;
}

.cluster-preview-empty {
  border: 1px dashed #d1d5db;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 12px;
  color: #6b7280;
  background: #fff;
}

.result-item.winner {
  background: #ecfdf5;
  border-color: #10b981;
}

.cluster-name {
  font-size: 15px;
  font-weight: 600;
  color: #333;
  line-height: 1.2;
  min-width: 120px;
  max-width: 50%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cluster-count {
  font-size: 14px;
  color: #6b7280;
  flex: 1 1 auto;
  min-width: 90px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cluster-metric {
  font-size: 14px;
  color: #6b7280;
  min-width: 100px;
  text-align: center;
}

.cluster-algo {
  font-size: 14px;
  font-weight: 600;
  color: #3b82f6;
  flex: 0 0 70px;
  min-width: 70px;
  text-align: right;
  white-space: nowrap;
}

@media (max-width: 1280px) {
  .cluster-summary {
    height: 36px;
    min-height: 36px;
    max-height: 36px;
  }
}

/* ========== Feature Chart ========== */
.feature-chart {
  padding: 10px 0;
}

.bar-chart {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.bar-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.bar-label {
  font-size: 14px;
  color: #4b5563;
  min-width: 100px;
  text-align: right;
}

.bar-track {
  flex: 1;
  height: 24px;
  background: #f3f4f6;
  border-radius: 4px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: #3b82f6;
  border-radius: 4px;
}

.bar-value {
  font-size: 14px;
  font-weight: 600;
  color: #3b82f6;
  min-width: 50px;
}

.chart-axis {
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
  padding-left: 112px;
  font-size: 12px;
  color: #9ca3af;
}

/* ========== Buttons ========== */
.btn {
  padding: 14px 24px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
  width: 100%;
}

.btn-primary {
  background: #3b82f6;
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: #2563eb;
}

.btn-primary:disabled {
  background: #e5e7eb;
  color: #9ca3af;
  cursor: not-allowed;
}

.btn.loading {
  background: #60a5fa;
  pointer-events: none;
}

.btn-large {
  padding: 18px 32px;
  font-size: 18px;
  margin-top: 20px;
}

.btn-download {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: #3b82f6;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  width: auto;
}

.btn-download:hover {
  background: #2563eb;
}

.result-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.result-header .panel-title {
  margin: 0;
}

.recovered-series-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  margin-right: 12px;
}

.recovered-series-controls label {
  font-size: 12px;
  color: #64748b;
  font-weight: 600;
}

.recovered-series-controls select {
  min-width: 130px;
  padding: 6px 10px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 12px;
  color: #0f172a;
  background: #fff;
}

.recovered-series-controls span {
  font-size: 12px;
  color: #64748b;
  white-space: nowrap;
}

/* ========== Console ========== */
.console-panel {
  background: #0f172a;
  border-radius: 12px;
  overflow: hidden;
}

.console-header {
  padding: 12px 18px;
  background: #1e293b;
  color: #94a3b8;
  font-size: 14px;
  font-weight: 600;
}

.console-body {
  padding: 14px 18px;
  min-height: 80px;
  max-height: 120px;
  overflow-y: auto;
  font-family: 'Monaco', 'Consolas', monospace;
}

.console-line {
  color: #94a3b8;
  font-size: 13px;
  line-height: 1.8;
  margin: 0;
}

.console-line.success {
  color: #34d399;
}

.console-line.error {
  color: #f87171;
}

.console-line.info {
  color: #60a5fa;
}

/* ========== Recommend Step 2 ========== */
.recommend-left {
  display: flex;
  flex-direction: column;
  gap: 20px;
  flex: 1;
  min-width: 45%;
}

.recommend-right {
  flex: 1;
  min-width: 45%;
  display: flex;
  flex-direction: column;
}

.rank-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.rank-item {
  display: flex;
  align-items: center;
  padding: 10px 14px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  gap: 12px;
  min-width: 0;
  overflow: hidden;
}

.rank-item.rank-1 {
  background: linear-gradient(135deg, #dbeafe 0%, #e0f2fe 100%);
  border-color: #3b82f6;
}

.rank-num {
  width: 32px;
  height: 32px;
  background: #e5e7eb;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #6b7280;
}

.rank-item.rank-1 .rank-num {
  background: #3b82f6;
  color: #fff;
}

.rank-name {
  font-size: 16px;
  font-weight: 600;
  color: #333;
}

/* Voting Table */
.voting-table-wrapper {
  overflow-x: auto;
}

.voting-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.voting-table th,
.voting-table td {
  padding: 10px 12px;
  border: 1px solid #e5e7eb;
  text-align: center;
}

.voting-table th {
  background: #f9fafb;
  font-weight: 600;
  color: #374151;
}

.voting-table td {
  color: #6b7280;
}

/* Baseline Tabs */
.baseline-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.baseline-tab {
  display: inline-flex;
  align-items: center;
  padding: 10px 16px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
  font-size: 14px;
  font-weight: 600;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.2s ease;
}

.baseline-tab:hover {
  border-color: #a78bfa;
  color: #7c3aed;
}

.baseline-tab input[type="checkbox"] {
  display: none;
}

.baseline-tab:has(input:checked) {
  background: #7c3aed;
  border-color: #7c3aed;
  color: #fff;
}


.baseline-details {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 0 0 auto;
  margin-bottom: 16px;
}

.baseline-card {
  padding: 10px 12px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
}

.baseline-card h4 {
  margin: 0 0 6px;
  font-size: 14px;
  color: #333;
}

.baseline-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.baseline-card-header h4 {
  margin: 0;
}

.baseline-select {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #6b7280;
  cursor: pointer;
  user-select: none;
}

.baseline-select input {
  accent-color: #7c3aed;
}

.baseline-info {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 16px;
  font-size: 13px;
  color: #6b7280;
  line-height: 1.5;
}

.baseline-info > div {
  flex: 0 1 auto;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.baseline-info span {
  font-weight: 600;
  color: #333;
}

/* ========== Recommend Step 3 ========== */
.comparison-table-wrapper {
  overflow-x: auto;
}

.comparison-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.comparison-table th {
  padding: 14px 16px;
  background: #f9fafb;
  border-bottom: 2px solid #e5e7eb;
  text-align: left;
  font-weight: 600;
  color: #374151;
}

.comparison-table td {
  padding: 14px 16px;
  border-bottom: 1px solid #f3f4f6;
  color: #4b5563;
}

.comparison-table tr.highlight {
  background: #eff6ff;
}

.comparison-table tr.highlight td {
  color: #1e40af;
  font-weight: 600;
}

.comparison-table .positive {
  color: #059669;
  font-weight: 600;
}

/* ========== Recommend Step 4 ========== */
.task-selector {
  display: flex;
  gap: 20px;
  margin-bottom: 20px;
}

.task-card {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  background: #fff;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.task-card:hover {
  border-color: #a7f3d0;
}

.task-card.active {
  border-color: #10b981;
  background: #ecfdf5;
}

.task-icon {
  width: 48px;
  height: 48px;
  background: #f3f4f6;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6b7280;
}

.task-card.active .task-icon {
  background: #d1fae5;
  color: #059669;
}

.task-icon svg {
  width: 24px;
  height: 24px;
}

.task-info h4 {
  margin: 0 0 4px;
  font-size: 16px;
  color: #333;
}

.task-info p {
  margin: 0;
  font-size: 13px;
  color: #6b7280;
}

/* Performance Cards */
.performance-row {
  display: flex;
  gap: 20px;
}

.performance-card {
  flex: 1;
  padding: 24px;
  border-radius: 14px;
  text-align: center;
}

.performance-card.with-imputepilot,
.performance-card.with-ImputePilot {
  background: #ecfdf5;
  border: 2px solid #10b981;
}

.performance-card.without-imputepilot,
.performance-card.without-ImputePilot {
  background: #fef3c7;
  border: 2px solid #f59e0b;
}

.performance-card.improvement {
  background: #eff6ff;
  border: 2px solid #3b82f6;
}

.perf-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 12px;
  font-size: 14px;
  font-weight: 600;
  color: #374151;
}

.performance-card.with-imputepilot .perf-header,
.performance-card.with-ImputePilot .perf-header {
  color: #059669;
}

.performance-card.without-imputepilot .perf-header,
.performance-card.without-ImputePilot .perf-header {
  color: #d97706;
}

.performance-card.improvement .perf-header {
  color: #2563eb;
}

.perf-value {
  font-size: 48px;
  font-weight: 800;
  color: #111;
  margin-bottom: 8px;
}

.perf-value.highlight {
  color: #2563eb;
}

.perf-metric {
  font-size: 14px;
  color: #6b7280;
}

/* ========== Responsive ========== */
@media (max-width: 1024px) {
  .step-content {
    flex-direction: column;
  }

  .upload-panel,
  .preview-panel,
  .param-panel,
  .result-panel,
  .recommend-left,
  .recommend-right {
    min-width: 100%;
  }

  .task-selector {
    flex-direction: column;
  }

  .performance-row {
    flex-direction: column;
  }
}

/* ========== ImputePilot Card Special Style ========== */
.baseline-card.ImputePilot-card {
  background: linear-gradient(135deg, #dbeafe 0%, #e0f2fe 100%);
  border-color: #3b82f6;
}

.baseline-card.ImputePilot-card h4 {
  color: #1d4ed8;
}

/* ========== Pipeline Evolution ========== */
.evolution-chart {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
  margin-top: 16px;
}

.evolution-bar-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.round-label {
  width: 30px;
  font-size: 12px;
  font-weight: 600;
  color: #6b7280;
}

.evolution-bar-track {
  flex: 1;
  height: 24px;
  background: #f3f4f6;
  border-radius: 4px;
  overflow: hidden;
}

.evolution-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6 0%, #60a5fa 100%);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 8px;
  transition: width 0.5s ease;
}

.evolution-bar-fill .bar-text {
  font-size: 11px;
  font-weight: 600;
  color: white;
}

.f1-badge {
  min-width: 45px;
  padding: 4px 8px;
  background: #dcfce7;
  color: #16a34a;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
}

.evolution-table-wrapper {
  overflow-x: auto;
  margin-top: 16px;
}

.evolution-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.evolution-table th,
.evolution-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid #e5e7eb;
}

.evolution-table th {
  background: #f9fafb;
  font-weight: 600;
  color: #6b7280;
  font-size: 11px;
  text-transform: uppercase;
}

.evolution-table .eliminated {
  color: #dc2626;
  font-weight: 500;
}

.evolution-table .best-pipeline {
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 12px;
  color: #7c3aed;
}

.evolution-table .final-round {
  background: #f0fdf4;
}

.evolution-table .final-round .best-pipeline {
  font-weight: 600;
}

/* ========== Time Series Chart Styles ========== */
.chart-container {
  background: #f8f9fa;
  border-radius: 8px;
  padding: 16px;
  border: 1px solid #e9ecef;
  margin-bottom: 16px;
  height: 220px;
  position: relative;
}

.chart-container.large {
  height: 280px;
}

.chart-container .chart-placeholder {
  position: absolute;
  inset: 16px;
  height: auto;
  margin: 0;
}

.chart-placeholder.hidden {
  display: none;
}

.chart-container canvas {
  max-height: 100%;
}

.missing-info {
  display: flex;
  gap: 24px;
  margin-bottom: 16px;
  padding: 12px 16px;
  background: #f8f9fa;
  border-radius: 8px;
  font-size: 13px;
}

.missing-info .info-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.missing-info .legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.missing-info .legend-dot.valid {
  background: #4CAF50;
}

.missing-info .legend-dot.missing {
  background: #ff6b6b;
}

.missing-info .stat-value {
  font-weight: 600;
  color: #333;
}

.missing-info .stat-label {
  color: #666;
}

/* ========== Baseline Enhancements ========== */
.baseline-actions {
  margin-bottom: 16px;
}

.baseline-card.baseline-not-trained {
  background: #fff7ed;
  border-color: #fed7aa;
}

.baseline-card.baseline-not-trained h4 {
  color: #c2410c;
}

.baseline-card.baseline-error {
  background: #fef2f2;
  border-color: #fecaca;
}

.baseline-card.baseline-error h4 {
  color: #dc2626;
}

.not-trained-message {
  color: #ea580c;
  margin-bottom: 12px;
  font-style: italic;
}

.error-message {
  color: #dc2626;
  font-size: 13px;
}

.trained-badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 500;
  color: #16a34a;
  background: #dcfce7;
  padding: 2px 8px;
  border-radius: 4px;
  margin-left: 8px;
}

.btn-small {
  padding: 6px 12px;
  font-size: 12px;
}

.btn-secondary {
  background: #6b7280;
  color: #fff;
  border: none;
  padding: 10px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  background: #4b5563;
}

.btn-train-baseline {
  background: #7c3aed;
  color: #fff;
  border: none;
  padding: 8px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  transition: all 0.2s ease;
}

.btn-train-baseline:hover {
  background: #6d28d9;
}

.baseline-tab:has(input:disabled) {
  opacity: 0.5;
  cursor: not-allowed;
}

.baseline-tab:has(input:disabled):hover {
  border-color: #e5e7eb;
  color: #6b7280;
}

/* Comparison table enhancements */
.comparison-table td.positive {
  color: #16a34a;
  font-weight: 600;
}

.comparison-table td.negative {
  color: #dc2626;
  font-weight: 600;
}

.extractor-info-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}

.extractor-info-item {
  padding: 16px 18px;
  min-width: 0;
  min-height: 96px;
  height: auto;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  border-left: 4px solid #ccc;
  background: #f9fafb;
}

.extractor-info-item.catch22 {
  border-left-color: #3b82f6;
}

.extractor-info-item.tsfresh {
  border-left-color: #10b981;
}

.extractor-info-item.topological {
  border-left-color: #f59e0b;
}

.extractor-info-item.kiviat {
  border-left-color: #8b5cf6;
}

.extractor-info-item.kats {
  border-left-color: #ec4899;
}

.extractor-info-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.extractor-info-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.extractor-info-dot.catch22 {
  background: #3b82f6;
}

.extractor-info-dot.tsfresh {
  background: #10b981;
}

.extractor-info-dot.topological {
  background: #f59e0b;
}

.extractor-info-dot.kiviat {
  background: #8b5cf6;
}

.extractor-info-dot.kats {
  background: #ec4899;
}

.extractor-info-name {
  font-size: 18px;
  font-weight: 700;
  color: #374151;
  flex: 1;
}

.extractor-info-count {
  font-size: 12px;
  font-weight: 600;
  color: #6b7280;
}

.extractor-info-desc {
  margin: 4px 0 0;
  font-size: 16px;
  color: #9ca3af;
  line-height: 1.3;
}

.extractor-total {
  font-size: 14px;
  font-weight: 700;
  color: #374151;
  text-align: center;
  padding: 10px 0;
  margin-bottom: 12px;
  border-top: 1px solid #e5e7eb;
}

.feature-config-panel {
  flex: 1.2;
  min-width: 56%;
}

#page-pipeline.cluster-layout-active .feature-config-panel {
  flex: 0 0 calc(50% - 9px);
  max-width: calc(50% - 9px);
}

#page-pipeline.cluster-layout-active #feature-result-panel {
  flex: 1 1 calc(50% - 9px);
  max-width: calc(50% - 9px);
}

#page-pipeline.cluster-layout-active #feature-config-panel .panel-title,
#page-pipeline.cluster-layout-active #feature-result-panel .panel-title {
  margin-bottom: 6px;
}

#page-pipeline.cluster-layout-active #feature-config-panel .panel-desc {
  margin-bottom: 10px;
  line-height: 1.35;
}

#page-pipeline.cluster-layout-active #feature-config-panel .extractor-info-list {
  gap: 10px;
  margin-bottom: 12px;
}

#page-pipeline.cluster-layout-active #feature-config-panel .extractor-info-item {
  padding: 12px 14px;
  min-height: 0;
}

#page-pipeline.cluster-layout-active #feature-config-panel .extractor-info-name {
  font-size: 16px;
}

#page-pipeline.cluster-layout-active #feature-config-panel .extractor-info-desc {
  font-size: 14px;
}

#page-pipeline.cluster-layout-active #feature-config-panel .extractor-total {
  margin-bottom: 10px;
  padding: 8px 0;
}

#page-pipeline.cluster-layout-active #feature-config-panel .btn {
  margin-top: auto;
}

.feature-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 20px;
  background: #7d3bf6;
  border-radius: 12px;
  margin-bottom: 20px;
  color: white;
}

#page-pipeline.cluster-layout-active #feature-results-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#page-pipeline.cluster-layout-active #feature-result-panel .feature-summary {
  padding: 14px 16px;
  margin-bottom: 0;
}

.feature-total {
  display: flex;
  flex-direction: column;
}

.total-number {
  font-size: 48px;
  font-weight: 800;
  line-height: 1;
}

#page-pipeline.cluster-layout-active #feature-result-panel .total-number {
  font-size: 38px;
}

#page-recommend .step-content[data-step="2"] {
  align-items: stretch;
}

#page-recommend .step-content[data-step="2"].active {
  flex-wrap: nowrap;
}

#page-recommend.feature-layout-active .step-content[data-step="2"].active {
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  gap: 18px;
  flex-wrap: nowrap;
}

#page-recommend.feature-layout-active #recommend-feature-config-panel,
#page-recommend.feature-layout-active #recommend-feature-result-panel {
  height: 100%;
  min-height: 0;
  padding: 14px 16px;
}

#page-recommend.feature-layout-active #recommend-feature-config-panel {
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
}

#page-recommend.feature-layout-active #recommend-feature-config-panel .panel-title,
#page-recommend.feature-layout-active #recommend-feature-result-panel .panel-title {
  margin-bottom: 6px;
}

#page-recommend.feature-layout-active #recommend-feature-config-panel .panel-desc {
  margin-bottom: 10px;
  line-height: 1.35;
}

#page-recommend.feature-layout-active #recommend-feature-config-panel .extractor-info-list {
  gap: 10px;
  margin-bottom: 12px;
}

#page-recommend.feature-layout-active #recommend-feature-config-panel .extractor-info-item {
  padding: 12px 14px;
  min-height: 0;
}

#page-recommend.feature-layout-active #recommend-feature-config-panel .extractor-info-name {
  font-size: 16px;
}

#page-recommend.feature-layout-active #recommend-feature-config-panel .extractor-info-desc {
  font-size: 14px;
}

#page-recommend.feature-layout-active #recommend-feature-config-panel .extractor-total {
  margin-bottom: 10px;
  padding: 8px 0;
}

#page-recommend.feature-layout-active #recommend-feature-config-panel .btn {
  margin-top: auto;
}

#page-recommend.feature-layout-active #recommend-feature-results-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#page-recommend #recommend-feature-config-panel,
#page-recommend #recommend-feature-result-panel {
  flex: 0 0 calc(50% - 9px);
  max-width: calc(50% - 9px);
  min-width: 0;
  height: 100%;
  min-height: 0;
}

#page-recommend #recommend-feature-config-panel {
  display: flex;
  flex-direction: column;
}

#page-recommend #recommend-feature-config-panel .btn {
  margin-top: auto;
}

#page-recommend #recommend-feature-results-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#page-recommend #recommend-feature-result-panel .feature-summary {
  padding: 14px 16px;
  margin-bottom: 0;
}

#page-recommend #recommend-feature-result-panel .total-number {
  font-size: 38px;
}

#page-recommend #recommend-feature-result-panel .extractor-cards {
  margin-bottom: 0;
}

#page-recommend #recommend-feature-result-panel .extractor-card {
  padding: 12px;
}

#page-recommend #recommend-feature-result-panel .feature-preview-panel {
  margin-top: 0;
  padding: 12px;
}

.total-label {
  font-size: 14px;
  opacity: 0.9;
  margin-top: 4px;
}

.feature-summary-dataset {
  font-size: 13px;
  font-weight: 600;
  opacity: 0.95;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 999px;
  padding: 8px 12px;
}

/* Extractor Cards */
.extractor-cards {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}

#page-pipeline.cluster-layout-active #feature-result-panel .extractor-cards {
  margin-bottom: 0;
}

.extractor-card {
  flex: 1;
  padding: 16px;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  background: #f9fafb;
  transition: all 0.2s ease;
}

#page-pipeline.cluster-layout-active #feature-result-panel .extractor-card {
  padding: 12px;
}

.extractor-card:hover {
  border-color: #c7d2fe;
  background: #f5f3ff;
}

.extractor-card.catch22 {
  border-left: 4px solid #3b82f6;
}

.extractor-card.tsfresh {
  border-left: 4px solid #10b981;
}

.extractor-card.topological {
  border-left: 4px solid #f59e0b;
}

.extractor-card.kiviat {
  border-left: 4px solid #8b5cf6;
}

.extractor-card.kats {
  border-left: 4px solid #ec4899;
}

.extractor-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.extractor-name {
  font-size: 14px;
  font-weight: 700;
  color: #374151;
}

.extractor-status {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  background: #dcfce7;
  color: #16a34a;
  font-weight: 600;
}

.extractor-count {
  font-size: 28px;
  font-weight: 800;
  color: #111;
  margin-bottom: 4px;
}

.extractor-desc {
  font-size: 12px;
  color: #6b7280;
  line-height: 1.4;
}

.feature-preview-panel {
  margin-top: 6px;
  padding: 16px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #f9fafb;
}

#page-pipeline.cluster-layout-active #feature-result-panel .feature-preview-panel {
  margin-top: 0;
  padding: 12px;
}

.feature-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.feature-preview-header h4 {
  margin: 0;
  font-size: 14px;
  color: #374151;
}

.feature-preview-dataset {
  font-size: 12px;
  color: #4b5563;
}

.feature-preview-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.feature-preview-tab {
  border: 1px solid #d1d5db;
  border-radius: 999px;
  background: #fff;
  color: #374151;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.feature-preview-tab:hover {
  border-color: #a5b4fc;
  color: #1e40af;
}

.feature-preview-tab.active {
  border-color: #6366f1;
  background: #eef2ff;
  color: #3730a3;
}

.feature-preview-empty {
  border: 1px dashed #d1d5db;
  border-radius: 10px;
  background: #fff;
  padding: 20px;
  text-align: center;
  font-size: 13px;
  color: #6b7280;
}

.feature-preview-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.feature-preview-controls label {
  font-size: 12px;
  color: #475569;
  font-weight: 600;
}

.feature-preview-controls select {
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  color: #1e293b;
  font-size: 12px;
  padding: 6px 10px;
}

.feature-preview-note {
  font-size: 12px;
  color: #6b7280;
  margin-left: auto;
}

.feature-preview-chart-wrapper {
  position: relative;
  height: 460px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 10px;
}

#page-pipeline.cluster-layout-active #feature-result-panel .feature-preview-chart-wrapper {
  height: min(320px, 34vh);
}

.feature-preview-chart-wrapper canvas {
  width: 100%;
  height: 100%;
}

@media (max-width: 1024px) {
  .feature-preview-chart-wrapper {
    height: 420px;
  }

  #page-pipeline.cluster-layout-active .step-content[data-step="2"].active {
    overflow: visible;
    flex-wrap: wrap;
  }

  #page-pipeline.cluster-layout-active .step-content[data-step="4"].active {
    overflow: visible;
    flex-wrap: wrap;
  }

  #page-pipeline.cluster-layout-active .step-content[data-step="5"].active {
    overflow: visible;
    flex-wrap: wrap;
  }

  #page-pipeline.cluster-layout-active #feature-config-panel,
  #page-pipeline.cluster-layout-active #feature-result-panel {
    height: auto;
    max-width: none;
    min-width: 45%;
  }

  #page-pipeline.cluster-layout-active #labeling-config-panel,
  #page-pipeline.cluster-layout-active #labeling-result-panel {
    height: auto;
    max-width: none;
    min-width: 45%;
  }

  #page-pipeline.cluster-layout-active #modelrace-config-panel,
  #page-pipeline.cluster-layout-active #modelrace-result-panel {
    height: auto;
    max-width: none;
    min-width: 45%;
  }

  #page-recommend .step-content[data-step="2"].active {
    overflow: visible;
    flex-wrap: wrap;
  }

  #page-recommend #recommend-feature-config-panel,
  #page-recommend #recommend-feature-result-panel {
    height: auto;
    max-width: none;
    min-width: 45%;
  }
}

@media (max-width: 920px) {
  .feature-summary {
    flex-direction: column;
    align-items: flex-start;
  }

  .feature-summary-dataset {
    width: 100%;
    border-radius: 10px;
  }

  .feature-preview-controls {
    flex-wrap: wrap;
    align-items: flex-start;
  }

  .feature-preview-note {
    margin-left: 0;
  }
}

@media (max-width: 768px) {
  .app {
    display: block;
  }

  .mobile-header {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 12px;
    height: 58px;
    padding: 0 16px;
    background: #0b1b5a;
    color: #fff;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.16);
  }

  .mobile-brand {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.4px;
  }

  .mobile-menu-toggle {
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    width: 40px;
    height: 40px;
    padding: 9px;
    border: 0;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.12);
    cursor: pointer;
  }

  .mobile-menu-toggle span {
    display: block;
    width: 100%;
    height: 2px;
    border-radius: 1px;
    background: #fff;
  }

  .mobile-menu-backdrop {
    position: fixed;
    inset: 0;
    z-index: 40;
    display: none;
    background: rgba(15, 23, 42, 0.42);
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 50;
    width: min(280px, 82vw);
    min-height: 100dvh;
    padding: 24px 18px;
    overflow-y: auto;
    transform: translateX(-105%);
    transition: transform 0.2s ease;
    box-shadow: 8px 0 24px rgba(15, 23, 42, 0.25);
  }

  body.mobile-menu-open {
    overflow: hidden;
  }

  body.mobile-menu-open .sidebar {
    transform: translateX(0);
  }

  body.mobile-menu-open .mobile-menu-backdrop {
    display: block;
  }

  .main {
    min-height: calc(100dvh - 58px);
    margin: 0;
    padding: 16px;
    border: 0;
    border-radius: 0;
    overflow: visible;
  }

  .main.cluster-layout-lock,
  #page-pipeline.cluster-layout-active.page.active,
  #page-recommend.feature-layout-active.page.active {
    height: auto;
    min-height: 0;
    overflow: visible;
  }

  .page-title {
    font-size: 26px;
  }

  .page-subtitle {
    line-height: 1.45;
  }

  .card-row {
    flex-direction: column;
    gap: 14px;
  }

  .stepper-card {
    height: auto;
    min-height: 0;
    max-height: none;
    padding: 14px;
    overflow-x: auto;
  }

  .stepper.stepper-square,
  .stepper.stepper-circle {
    min-width: 620px;
    flex-wrap: nowrap;
  }

  .stepper-square .step {
    min-width: 108px;
  }

  .stepper-square .step-icon,
  .stepper-circle .step-icon {
    width: 46px;
    height: 46px;
  }

  .stepper-square .step-label,
  .stepper-circle .step-label {
    font-size: 12px;
  }

  .stepper-circle .step-arrow {
    top: 12px;
  }

  .benchmark-controls,
  .feature-preview-controls {
    align-items: stretch;
  }

  .benchmark-control,
  .feature-preview-controls select,
  .feature-preview-controls button {
    width: 100%;
  }

  .btn {
    width: 100%;
    justify-content: center;
  }

  .fixed-scroll-panel {
    height: auto;
    min-height: 0;
    max-height: none;
  }

  #cluster-results,
  #feature-results-container,
  #recommend-feature-results-container {
    max-height: 52vh;
  }

  .extractor-cards {
    flex-direction: column;
  }

  .result-header {
    flex-wrap: wrap;
    row-gap: 8px;
  }

  .recovered-series-controls {
    order: 3;
    width: 100%;
    margin: 0;
    flex-wrap: wrap;
  }

  .recovered-series-controls select {
    flex: 1;
    min-width: 120px;
  }

  .feature-preview-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .feature-preview-tabs {
    width: 100%;
  }

  .feature-preview-tab {
    flex: 1;
    text-align: center;
  }

  .feature-preview-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .feature-preview-chart-wrapper {
    height: 300px;
  }
}

@media (max-width: 420px) {
  .feature-preview-chart-wrapper {
    height: 320px;
  }
}

/* Feature Categories (legacy styles retained for backward compatibility) */
.category-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.category-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.category-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.category-dot.canonical {
  background: #3b82f6;
}

.category-dot.dependencies {
  background: #8b5cf6;
}

.category-dot.trends {
  background: #10b981;
}

.category-dot.topological {
  background: #f59e0b;
}

.category-name {
  font-size: 13px;
  font-weight: 600;
  color: #374151;
  min-width: 90px;
}

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

@media (max-width: 768px) {
  .category-list {
    grid-template-columns: 1fr;
  }
}

/* Legacy table styles kept but no longer used by feature preview */
.feature-preview-table-scroll {
  overflow-x: auto;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
}

.feature-preview-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
}

.feature-preview-table th,
.feature-preview-table td {
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid #f1f5f9;
  font-size: 12px;
  white-space: nowrap;
}

.feature-preview-table th {
  background: #f8fafc;
  color: #475569;
  font-weight: 700;
  position: sticky;
  top: 0;
  z-index: 1;
}

.feature-preview-table td {
  color: #111827;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.feature-cell-empty {
  color: #9ca3af;
}
