/* GritHQ Progress page — authoritative stabilization layer.
   Progress-specific finalization changes live here. Shared primitives remain
   in styles.css until the final whole-app consolidation after every page is frozen. */

#view-history{
  --progress-border:rgba(62,100,138,.42);
  --progress-border-soft:rgba(62,100,138,.28);
  --progress-panel:#08131e;
  --progress-panel-2:#0a1724;
  --progress-blue:#2f91ff;
  --progress-cyan:#23c7e6;
  --progress-muted:#91a1b3;
  min-width:0;
}

#view-history.active{
  animation:none!important;
  contain:layout style;
  transform:none!important;
  will-change:auto!important;
}

#view-history .progress-page-head{
  align-items:flex-start;
  margin:4px 2px 14px;
}

#view-history .progress-page-head h2{
  margin:3px 0 6px;
  letter-spacing:-.045em;
}

#view-history .progress-page-head .subtle{
  max-width:64ch;
  margin:0;
  color:var(--progress-muted);
}

/* Area selector: fixed 4-way segmented control. Never horizontally scrolls. */
#view-history .progress-area-tabs{
  display:grid!important;
  grid-template-columns:repeat(4,minmax(0,1fr))!important;
  gap:6px!important;
  margin:0 0 14px!important;
  padding:6px!important;
  overflow:hidden!important;
  border:1px solid var(--progress-border)!important;
  border-radius:18px!important;
  background:linear-gradient(180deg,#071522,#05101b)!important;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.035),0 10px 24px rgba(0,0,0,.13)!important;
}

#view-history .progress-area-tab{
  min-width:0!important;
  min-height:48px!important;
  padding:7px 5px!important;
  display:flex!important;
  align-items:center!important;
  justify-content:center!important;
  text-align:center!important;
  white-space:normal!important;
  overflow-wrap:normal!important;
  word-break:keep-all!important;
  border:1px solid rgba(73,108,144,.22)!important;
  border-radius:13px!important;
  background:linear-gradient(180deg,#0a1826,#08131f)!important;
  color:#b7c5d3!important;
  font-size:12px!important;
  line-height:1.08!important;
  font-weight:820!important;
  letter-spacing:-.01em!important;
  touch-action:manipulation;
  -webkit-tap-highlight-color:transparent;
}

#view-history .progress-area-tab.active{
  border-color:rgba(119,188,255,.5)!important;
  background:linear-gradient(145deg,#2d74ed,#1598fa)!important;
  color:#fff!important;
  box-shadow:0 9px 20px rgba(28,103,221,.22),inset 0 1px 0 rgba(255,255,255,.16)!important;
}

/* Dashboard cards carry the same restrained GritHQ depth as Home/Train. */
#view-history .stats-grid,
#view-history .performance-stats-grid{
  gap:10px;
}

#view-history .stat{
  min-width:0;
  min-height:92px;
  display:flex;
  flex-direction:column;
  justify-content:center;
  padding:14px 15px;
  border:1px solid var(--progress-border-soft);
  border-radius:16px;
  background:
    radial-gradient(circle at 88% 8%,rgba(47,145,255,.07),transparent 38%),
    linear-gradient(145deg,#0b1826,#08131e);
  box-shadow:inset 0 1px 0 rgba(255,255,255,.025);
}

#view-history .stat strong{
  margin-bottom:6px;
  color:#f5f8fc;
  font-size:25px;
  line-height:1;
}

#view-history .stat span{
  color:var(--progress-muted);
  font-size:12px;
  line-height:1.3;
}

#view-history .comparison-card,
#view-history .chart-card,
#view-history .recent-progress-card,
#view-history .exercise-progress-card,
#view-history .interval-training-card,
#view-history .workout-complete-summary,
#view-history .insight-grid{
  border-color:var(--progress-border-soft);
  background:linear-gradient(145deg,#0a1724,#08131e);
  box-shadow:inset 0 1px 0 rgba(255,255,255,.025);
}

#view-history .comparison-card,
#view-history .chart-card,
#view-history .interval-training-card,
#view-history .workout-complete-summary{
  padding:17px;
  border-radius:17px;
}

#view-history .comparison-head h3,
#view-history .chart-card h3,
#view-history .performance-section-heading h3,
#view-history .exercise-progress-head h3,
#view-history .section-title-row h3{
  letter-spacing:-.025em;
}

#view-history .comparison-grid{
  gap:9px;
}

#view-history .comparison-metric{
  min-width:0;
  padding:13px;
  border:1px solid var(--progress-border-soft);
  border-radius:13px;
  background:#091522;
}

#view-history .comparison-metric strong{
  font-size:22px;
}

#view-history .chart-wrap{
  min-width:0;
  overflow:hidden;
}

#view-history .bar{
  background:linear-gradient(to top,#267ae9,#20c8e5);
}

#view-history .performance-section-heading{
  margin-top:28px;
}

#view-history .performance-stats-grid .stat strong{
  font-size:20px;
  overflow-wrap:anywhere;
}

#view-history .recent-progress-card{
  padding:6px 14px;
  overflow:hidden;
}

#view-history .recent-progress-row{
  min-height:62px;
  padding:11px 3px;
  gap:12px;
  touch-action:manipulation;
}

#view-history .recent-progress-main strong{
  font-size:14px;
}

#view-history .recent-progress-main small,
#view-history .recent-progress-result b{
  font-size:11px;
}

#view-history .recent-progress-result strong{
  font-size:15px;
}

/* Exercise progress tools stay compact but fully tappable. */
#view-history .exercise-progress-card{
  padding:16px;
  border-radius:17px;
}

#view-history .exercise-progress-tools{
  display:grid;
  grid-template-columns:minmax(0,1fr) minmax(220px,300px);
  align-items:center;
  gap:10px;
  margin:15px 0 12px;
}

#view-history .progress-filter-chips{
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:6px;
  min-width:0;
}

#view-history .progress-filter-chip{
  min-width:0;
  min-height:40px;
  padding:6px 8px;
  border:1px solid var(--progress-border-soft);
  border-radius:11px;
  background:#091522;
  color:#9fb0c0;
  font-size:11px;
  font-weight:800;
  touch-action:manipulation;
}

#view-history .progress-filter-chip.active{
  border-color:rgba(75,150,245,.45);
  background:rgba(38,116,225,.18);
  color:#82b9ff;
  box-shadow:inset 0 0 0 1px rgba(57,135,235,.12);
}

#view-history .progress-search{
  min-width:0;
  width:100%;
  margin:0;
}

#view-history .progress-search input{
  width:100%;
  min-height:42px;
  padding:8px 11px;
  border:1px solid var(--progress-border);
  border-radius:11px;
  background:#06111c;
  color:#eef5fb;
}

#view-history .progress-search input::placeholder{color:#728396}

#view-history .exercise-progress-list{
  gap:9px;
  min-width:0;
}

#view-history .exercise-progress-item{
  border-color:var(--progress-border-soft);
  border-radius:14px;
  background:#091522;
  content-visibility:auto;
  contain-intrinsic-size:auto 118px;
  transform:none!important;
}

#view-history .exercise-progress-item.expanded{
  border-color:rgba(52,139,247,.55);
  background:#0a1825;
  content-visibility:visible;
  contain:none;
}

#view-history .exercise-progress-toggle{
  min-height:62px;
  padding:12px;
  gap:9px;
  touch-action:manipulation;
}

#view-history .exercise-progress-name strong{font-size:14px}
#view-history .exercise-progress-name small{font-size:10px}
#view-history .exercise-progress-current strong{font-size:14px}
#view-history .exercise-progress-current small{font-size:9px}
#view-history .exercise-progress-current b{font-size:10px}

#view-history .exercise-progress-favorite{
  width:46px;
  min-width:46px;
  touch-action:manipulation;
}

#view-history .exercise-progress-compact{
  gap:7px;
  padding:0 12px 12px;
}

#view-history .exercise-progress-compact>div:not(.exercise-mini-trend){
  padding:9px;
  border-color:rgba(65,101,137,.24);
  background:#07121d;
}

#view-history .exercise-progress-expanded{
  padding:0 12px 14px;
  animation:none;
}

#view-history .exercise-progress-chart{
  -webkit-overflow-scrolling:touch;
  overscroll-behavior-x:contain;
}

#view-history .exercise-progress-bar{
  background:linear-gradient(180deg,#22c4df,#2f83ff);
}

#view-history .exercise-best-grid>div,
#view-history .exercise-lifetime-grid>div{
  border-color:var(--progress-border-soft);
  background:#07131f;
}

#view-history .interval-training-row,
#view-history .milestone-item,
#view-history .history-row{
  border-color:var(--progress-border-soft);
  background:linear-gradient(145deg,#0a1724,#08131e);
}

#view-history .interval-training-row{
  min-width:0;
}

#view-history .lifetime-work-grid{
  gap:9px;
}

#view-history .insight-grid>div{
  min-width:0;
  border-color:var(--progress-border-soft);
  background:#091522;
}

#view-history .milestone-grid{
  gap:9px;
}

#view-history .milestone-item{
  min-width:0;
}

#view-history .milestone-track{
  background:#06101a;
}

#view-history .milestone-track span{
  background:linear-gradient(90deg,#28b971,#55e59a);
}

#view-history .history-list{
  gap:8px;
  padding-bottom:4px;
}

#view-history .history-row{
  min-width:0;
  padding:12px 13px;
}

#view-history .history-row .routine-meta{
  min-width:0;
  row-gap:4px;
  font-size:11px!important;
}

#view-history .history-delete{
  width:44px;
  min-width:44px;
  height:44px;
  touch-action:manipulation;
}

#view-history .empty{
  border-color:rgba(75,111,148,.42);
  background:rgba(6,16,27,.55);
}

@media(max-width:760px){
  #view-history .progress-page-head{
    margin-top:3px;
  }

  #view-history .progress-page-head h2{
    font-size:28px;
  }

  #view-history .progress-page-head .subtle{
    font-size:13px!important;
    line-height:1.42!important;
  }

  #view-history .stats-grid,
  #view-history .performance-stats-grid{
    grid-template-columns:repeat(2,minmax(0,1fr));
  }

  #view-history .stat{
    min-height:86px;
    padding:13px;
  }

  #view-history .stat strong{font-size:23px}
  #view-history .stat span{font-size:11px}

  #view-history .exercise-progress-tools{
    grid-template-columns:1fr;
  }

  #view-history .progress-search{
    grid-row:2;
  }

  #view-history .exercise-progress-compact{
    grid-template-columns:repeat(3,minmax(0,1fr));
  }

  #view-history .exercise-mini-trend{
    grid-column:1/-1;
  }

  #view-history .lifetime-work-grid{
    grid-template-columns:repeat(2,minmax(0,1fr));
  }
}

@media(max-width:430px){
  #view-history .progress-area-tabs{
    gap:4px!important;
    padding:5px!important;
  }

  #view-history .progress-area-tab{
    min-height:45px!important;
    padding:5px 3px!important;
    font-size:11px!important;
  }

  #view-history .comparison-card,
  #view-history .chart-card,
  #view-history .interval-training-card,
  #view-history .workout-complete-summary,
  #view-history .exercise-progress-card{
    padding:14px;
  }

  #view-history .comparison-metric strong{font-size:20px}

  #view-history .progress-filter-chips{
    gap:5px;
  }

  #view-history .progress-filter-chip{
    min-height:42px;
    padding:5px 4px;
    font-size:10px;
  }

  #view-history .exercise-progress-toggle{
    grid-template-columns:minmax(0,1fr) auto auto;
    padding:11px 10px;
  }

  #view-history .exercise-progress-compact{
    grid-template-columns:1fr 1fr;
    padding:0 10px 10px;
  }

  #view-history .exercise-progress-compact>div:nth-child(3){grid-column:1/-1}
  #view-history .exercise-mini-trend{grid-column:1/-1}

  #view-history .exercise-best-grid,
  #view-history .exercise-lifetime-grid{
    grid-template-columns:repeat(2,minmax(0,1fr));
  }

  #view-history .milestone-grid{grid-template-columns:1fr}
  #view-history .interval-training-row{flex-direction:column}
  #view-history .interval-training-row>div:last-child{text-align:left}
}

@media(max-width:370px){
  #view-history .progress-area-tab{
    font-size:10px!important;
    letter-spacing:-.02em!important;
  }

  #view-history .stat{
    min-height:82px;
    padding:11px;
  }

  #view-history .stat strong{font-size:21px}
}
