/* Project actions share the return row without competing with the title. */
.pdca-toolbar.project-topbar { justify-content: space-between; align-items: center; gap: 16px 24px; }
.project-return, .project-management-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.project-return { flex: 1 1 300px; min-width: 0; }
.project-return .pdca-muted { font-size: 13px; }
.project-management-actions { margin-left: auto; justify-content: flex-end; }
.project-topbar .pdca-btn { min-height: 44px; white-space: nowrap; }

/* One shared toolbar for project and standalone analyses. */
.analysis-context-bar[data-analysis-controls] {
  display: grid; grid-template-columns: minmax(180px, 1fr) auto;
  align-items: end; gap: 12px 24px; padding: 18px 20px; margin-bottom: 24px;
}
.analysis-context-bar .analysis-context-selection { min-width: 0; align-items: end; }
.analysis-context-bar .analysis-group-control { width: 240px; max-width: 100%; gap: 8px; }
.analysis-context-bar .analysis-group-control select {
  height: 44px; min-height: 44px; padding: 10px 32px 10px 12px; text-overflow: ellipsis;
}
.analysis-context-bar .analysis-context-actions {
  display: flex; align-items: center; justify-content: flex-end; gap: 10px;
  flex-wrap: wrap; max-width: none; min-width: 0;
}
.analysis-context-actions > .pdca-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; min-height: 44px; padding: 10px 14px; line-height: 1.3;
}
.analysis-context-actions [data-save-view] { border-color: #c6d8e0; background: #fff; color: #315b6c; }
.analysis-context-actions [data-save-view]:hover { border-color: #a3bdc9; background: #f6fafc; }
.analysis-context-bar > .analysis-save-status { grid-column: 1 / -1; white-space: normal; text-align: right; line-height: 1.5; }
.analysis-context-bar > .analysis-save-status[hidden] { display: none; }

/* Align filter buttons with the inputs, below their labels. */
.stats-controls { align-items: end; gap: 16px 12px; padding-bottom: 26px; }
.stats-controls > .pdca-field { min-width: 125px; flex: 0 1 145px; }
.stats-controls > .pdca-field:first-child { min-width: 190px; flex: 1 1 210px; max-width: none; }
.stats-controls > .pdca-field select, .regression-filter-bar > .pdca-field select {
  height: 44px; min-height: 44px; min-width: 0; padding: 10px 30px 10px 12px;
  line-height: 1.3; text-overflow: ellipsis;
}
.analysis-filter-actions { display: flex; align-items: center; gap: 12px; min-height: 44px; flex: none; position: relative; }
.analysis-filter-actions > .report-filter, .regression-filter-bar > .report-filter { margin-bottom: 0; }
.analysis-filter-actions .report-filter-trigger:not(.stats-info),
.regression-filter-bar > .report-filter > .report-filter-trigger {
  height: 44px; min-height: 44px; padding: 0 13px; gap: 8px;
  color: #0f4c5c; background: #e5f1f2; border-color: #bdd6da; font-weight: 600;
}
.analysis-filter-actions .report-filter-trigger:not(.stats-info):hover,
.regression-filter-bar > .report-filter > .report-filter-trigger:hover,
.analysis-filter-actions .report-filter-trigger[aria-expanded="true"]:not(.stats-info),
.regression-filter-bar > .report-filter > .report-filter-trigger[aria-expanded="true"] {
  background: #d8ebee; border-color: #92bac3;
}
.analysis-filter-actions .report-filter-trigger > span,
.regression-filter-bar > .report-filter > .report-filter-trigger > span { display: inline; font-size: 14px; white-space: nowrap; }
.report-filter > .report-filter-trigger.stats-info, .stats-controls .stats-info {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; min-width: 28px; min-height: 28px; padding: 0;
  border-radius: 50%; border: 1px solid #a9c3cf; color: #365f72; background: #f5fafb;
}
.report-filter > .report-filter-trigger.stats-info:hover, .stats-controls .stats-info:hover { background: #e7f1f5; border-color: #7da4b7; }
.stats-info .stats-info-glyph, .report-filter > .report-filter-trigger .stats-info-glyph {
  display: block; font-family: Georgia, "Times New Roman", serif; font-style: italic;
  font-size: 18px; font-weight: 700; line-height: 1; text-transform: none;
}
.analysis-filter-actions .report-filter-content, .regression-filter-bar > .report-filter > .report-filter-content { top: calc(100% + 8px); }

/* Keep the generation action and saved analyses beside the regression filters. */
.regression-filter-bar { gap: 14px 12px; margin-bottom: 10px; }
.regression-filter-bar > .pdca-field { min-width: 125px; flex: 0 1 145px; }
.regression-filter-bar > .pdca-field.regression-saved-picker { min-width: 205px; flex: 1 1 225px; }
.regression-filter-bar > .pdca-btn {
  margin-left: 0; height: 44px; min-height: 44px; padding: 10px 14px;
  display: inline-flex; align-items: center; justify-content: center; white-space: nowrap; flex: none;
}
.regression-filter-bar > .pdca-field { font-size: 13px; }
.regression-saved-hint { margin: 0 0 28px; font-size: 13px; line-height: 1.5; color: #617985; }
.regression-model-name { gap: 10px; }
.regression-rank {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  min-width: 25px; font-size: 15px; font-weight: 750; color: #0f4c5c;
  font-variant-numeric: tabular-nums;
}

/* A filled parent and a text-only selection clarify the navigation hierarchy. */
.sidebar .nav button.active-parent { background: #edf4ff; color: var(--blue); font-weight: 650; }
.sidebar .nav .nav-submenu button.active,
.sidebar .nav .nav-submenu button.active:hover { background: transparent; color: #1949b5; font-weight: 750; }

@media (max-width: 1120px) {
  .analysis-context-bar[data-analysis-controls] { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .analysis-context-bar .analysis-group-control { width: 100%; }
  .analysis-context-bar .analysis-context-actions { justify-content: flex-start; }
  .analysis-context-bar > .analysis-save-status { text-align: left; }
}
@media (max-width: 600px) {
  .project-return { flex-basis: 100%; gap: 10px; }
  .project-management-actions { gap: 8px; }
  .project-topbar .pdca-btn { padding: 10px 12px; }
  .analysis-context-bar[data-analysis-controls] { padding: 16px; }
  .analysis-context-bar .analysis-context-actions { gap: 8px; }
  .analysis-context-actions > .pdca-btn { height: auto; min-height: 44px; white-space: normal; text-align: center; padding: 10px 12px; }
  .stats-controls > .pdca-field, .stats-controls > .pdca-field:first-child { flex: 1 1 140px; min-width: 0; }
  .stats-controls > .pdca-field:first-child { flex-basis: 100%; }
  .stats-controls { padding-bottom: 24px; }
  .analysis-filter-actions { width: 100%; }
  .analysis-filter-actions > .report-filter { position: static; }
  .analysis-filter-actions .report-filter-content { right: auto; left: 0; }
  .regression-filter-bar > .pdca-field { flex: 1 1 130px; min-width: 0; }
  .regression-filter-bar > .pdca-field.regression-saved-picker { flex-basis: 100%; min-width: 0; }
  .regression-filter-bar > .report-filter > .report-filter-content { left: 0; right: auto; }
}
