.history-view .page-head p:not(.eyebrow) { margin: 8px 0 0; color: var(--muted); }
.record-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.record-actions button:disabled { cursor: not-allowed; opacity: .38; }
.print-report-head { display: none; }
.danger-soft { border: 1px solid rgba(255, 120, 73, .55); background: rgba(255, 120, 73, .1); color: #ff9a76; }
.pdf-download { border: 1px solid rgba(108, 166, 255, .65); background: rgba(108, 166, 255, .14); color: #a9cbff; }
.pdf-download:hover:not(:disabled) { background: rgba(108, 166, 255, .24); }
.danger-soft:hover:not(:disabled) { background: rgba(255, 120, 73, .2); }
.danger-soft:disabled { cursor: not-allowed; opacity: .38; }
.history-row { grid-template-columns: minmax(0, 1fr) auto auto auto; align-items: center; }
.history-record-delete { padding: 8px 12px; border: 1px solid rgba(255, 120, 73, .45); background: transparent; color: #ff9a76; font-size: 12px; }
.history-record-delete:hover { background: rgba(255, 120, 73, .14); }

.insights-profile,
.latest-insight-card,
.weekly-insight-card,
.insights-empty-card {
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.insights-profile {
  display: grid;
  grid-template-columns: minmax(240px, .8fr) minmax(0, 1.4fr);
  align-items: end;
  gap: 24px;
  padding: 20px;
}

.insights-profile h2 { margin: 0; font-size: 22px; }
.insights-profile p:not(.eyebrow) { margin: 6px 0 0; color: var(--muted); font-size: 13px; }
.insights-profile__fields { display: grid; grid-template-columns: 1fr 1fr auto; align-items: end; gap: 10px; }
.insights-profile__fields label { color: var(--muted); font-size: 13px; }
.insights-profile__fields label > span { display: flex; align-items: center; gap: 6px; }
.insights-profile__fields input,
.insights-profile__fields select {
  width: 100%;
  height: 46px;
  margin-top: 6px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--bg);
  color: var(--text);
}
.insights-profile__fields button { min-height: 46px; white-space: nowrap; }

.latest-insight-card,
.weekly-insight-card { padding: clamp(18px, 3vw, 28px); }
.insights-heading { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-bottom: 16px; }
.insights-heading span { color: var(--lime); font-size: 12px; font-weight: 900; letter-spacing: .08em; }
.insights-heading strong { font-size: 18px; text-align: right; }

.insight-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; }
.insight-kpis article { min-width: 0; padding: 15px; border: 1px solid var(--line); border-radius: 15px; background: var(--bg); }
.insight-kpis span,
.insight-kpis small { display: block; color: var(--muted); font-size: 12px; }
.insight-kpis strong { display: block; margin: 7px 0 4px; font-size: clamp(18px, 2vw, 25px); line-height: 1.15; overflow-wrap: anywhere; }

.result-insight-grid { display: grid; grid-template-columns: 1.25fr .75fr; gap: 10px; margin-top: 10px; }
.result-insight-grid > article { min-width: 0; padding: 17px; border: 1px solid var(--line); border-radius: 16px; background: var(--bg); }
.result-insight-grid h3,
.result-insight-grid h4 { margin: 0 0 14px; font-size: 15px; }

.set-performance-chart,
.week-chart { display: flex; align-items: end; justify-content: center; gap: 9px; height: 145px; }
.set-performance-bar,
.week-bar { display: flex; flex: 1; min-width: 0; height: 100%; flex-direction: column; align-items: center; justify-content: end; }
.set-performance-bar > span,
.week-bar > span { min-height: 18px; color: var(--muted); font-size: 11px; font-weight: 800; }
.set-performance-bar > i,
.week-bar > i { display: flex; width: min(38px, 80%); height: 92px; align-items: end; border-radius: 8px 8px 3px 3px; background: var(--panel2); overflow: hidden; }
.set-performance-bar > i b,
.week-bar > i b { display: block; width: 100%; min-height: 3px; border-radius: 8px 8px 3px 3px; background: linear-gradient(#efff78, var(--lime)); }
.set-performance-bar small,
.week-bar small { margin-top: 7px; color: var(--muted); font-size: 11px; white-space: nowrap; }

.comparison-card { display: flex; flex-direction: column; justify-content: center; }
.comparison-card > strong { color: var(--lime); font-size: 22px; line-height: 1.25; }
.comparison-card p { margin: 8px 0 0; color: var(--muted); font-size: 13px; line-height: 1.55; }
.comparison-card.gentle > strong { color: #ffc266; }
.comparison-card.neutral > strong { color: var(--text); }

.weekly-insight-head { display: flex; align-items: end; justify-content: space-between; gap: 15px; margin-bottom: 4px; }
.weekly-insight-head span { color: var(--lime); font-size: 12px; font-weight: 900; }
.weekly-insight-head h2 { margin: 3px 0 0; }
.weekly-insight-head > div:last-child { text-align: right; }
.weekly-insight-head > div:last-child strong,
.weekly-insight-head > div:last-child small { display: block; }
.weekly-insight-head > div:last-child strong { font-size: 25px; }
.weekly-insight-head > div:last-child small { color: var(--muted); }

.calorie-note { margin: 13px 0 0; color: var(--muted); font-size: 11px; line-height: 1.55; }
.dashboard-note { margin: -7px 3px 24px; }
.insights-empty-card { padding: 28px; text-align: center; }
.insights-empty-card strong { font-size: 20px; }
.insights-empty-card p,
.insights-empty { color: var(--muted); }

#summaryDialog { width: min(820px, calc(100% - 24px)); max-height: calc(100dvh - 24px); overflow-y: auto; }
.workout-result-insights { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--line); text-align: left; }
.workout-result-insights .insight-kpis { grid-template-columns: repeat(4, 1fr); }
.workout-result-insights .result-insight-grid { grid-template-columns: 1.1fr .9fr; }

@media (max-width: 800px) {
  .insights-profile { grid-template-columns: 1fr; align-items: stretch; }
  .insight-kpis,
  .workout-result-insights .insight-kpis { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
  .history-view .page-head { margin-bottom: 22px; }
  .history-view .page-head p:not(.eyebrow) { font-size: 13px; }
  .record-actions { display: grid; width: 100%; grid-template-columns: 1fr 1fr; }
  .record-actions #printReportBtn { grid-column: 1 / -1; }
  .record-actions #downloadPdfBtn { grid-column: 1 / -1; }
  .record-actions button { padding: 11px 8px; }
  .history-row { grid-template-columns: minmax(0, 1fr) auto; gap: 5px 10px; }
  .history-row > strong { grid-column: 1; }
  .history-row > span:not(.history-date) { grid-column: 1; }
  .history-row .history-date { display: none; }
  .history-record-delete { grid-column: 2; grid-row: 1 / 3; min-height: 44px; }
  .insights-profile { gap: 16px; padding: 16px; }
  .insights-profile__fields { grid-template-columns: 1fr 1fr; }
  .insights-profile__fields button { grid-column: 1 / -1; }
  .insights-heading { display: block; }
  .insights-heading strong { display: block; margin-top: 5px; text-align: left; }
  .result-insight-grid,
  .workout-result-insights .result-insight-grid { grid-template-columns: 1fr; }
  .set-performance-chart,
  .week-chart { gap: 4px; height: 132px; }
  .set-performance-bar > i,
  .week-bar > i { width: min(28px, 82%); height: 80px; }
  .weekly-insight-head { align-items: start; }
  .weekly-insight-head h2 { font-size: 21px; }
  .weekly-insight-head > div:last-child strong { font-size: 21px; }
  .summary { padding: 24px 15px; }
  .workout-result-insights .insight-kpis strong { font-size: 17px; }
}

@media (max-width: 380px) {
  .insights-profile__fields,
  .insight-kpis,
  .workout-result-insights .insight-kpis { grid-template-columns: 1fr; }
}

@media print {
  @page { size: A4; margin: 13mm; }
  :root { color-scheme: light; }
  html,
  body { background: #fff !important; color: #111 !important; }
  body { background-image: none !important; }
  .site-head,
  .site-footer,
  .record-actions,
  .insights-profile,
  .history-record-delete,
  .dashboard-note,
  .toast { display: none !important; }
  main { max-width: none; }
  .view { display: none !important; }
  #historyView { display: block !important; padding: 0 !important; }
  #historyView > .page-head { display: none !important; }
  .print-report-head { display: block; margin-bottom: 9mm; padding-bottom: 5mm; border-bottom: 2px solid #111; }
  .print-report-head span { font-size: 10pt; font-weight: 900; letter-spacing: .15em; }
  .print-report-head h1 { margin: 2mm 0 1mm; font-size: 25pt; }
  .print-report-head p { margin: 0; color: #555; font-size: 9pt; }
  .latest-insight-card,
  .weekly-insight-card,
  .insights-empty-card,
  .stat,
  .history-card,
  .insight-kpis article,
  .result-insight-grid > article { border-color: #bbb !important; background: #fff !important; box-shadow: none !important; }
  .latest-insight-card,
  .weekly-insight-card,
  .history-card { break-inside: avoid; margin-bottom: 5mm; padding: 5mm; }
  .insights-heading span,
  .weekly-insight-head span,
  .comparison-card > strong { color: #111 !important; }
  .insight-kpis span,
  .insight-kpis small,
  .comparison-card p,
  .weekly-insight-head small,
  .set-performance-bar > span,
  .week-bar > span,
  .set-performance-bar small,
  .week-bar small,
  .history-row span,
  .stat span { color: #555 !important; }
  .set-performance-bar > i,
  .week-bar > i { background: #eee !important; }
  .set-performance-bar > i b,
  .week-bar > i b { background: #444 !important; }
  .stats-grid { break-inside: avoid; margin-bottom: 5mm; }
  .history-row { grid-template-columns: 1fr auto auto; break-inside: avoid; }
  .history-row .history-date { display: block !important; }
}
