/* RepRoom V5.3 beta — carried-forward V5.2.1 targeted rhythm/alignment polish.
   Layered after V5.2; semantic palette, navigation and behaviors are untouched. */
:root{
  --layout-action-gap:16px;
  --layout-compact-gap:12px;
  --layout-card-content-gap:12px;
}

/* 1. The three Overview metrics share a rigid label/value rhythm.
   Reserving two label lines prevents the long exercise label from lowering its number. */
.overview-stats{align-items:stretch;gap:12px}
.overview-stats>.stat{
  min-width:0;
  min-height:118px;
  display:flex;
  flex-direction:column;
  align-items:flex-start;
  padding:17px 16px 15px;
}
.overview-stats>.stat>.label{
  width:100%;
  min-height:2.75em;
  line-height:1.375;
  display:-webkit-box;
  -webkit-box-orient:vertical;
  -webkit-line-clamp:2;
  overflow:hidden;
  overflow-wrap:normal;
}
.overview-stats>.stat>.value{
  margin-top:auto;
  align-self:flex-start; /* V5.3 beta otherwise aligns values to each card's right edge */
  padding-top:8px;
  font-size:clamp(23px,2.5vw,28px);
  font-weight:750;
  line-height:1.13;
  font-variant-numeric:tabular-nums lining-nums;
  white-space:nowrap;
  letter-spacing:-.035em;
}
/* Summary metrics use the same number treatment without changing their content. */
.summary-stats>.stat{display:flex;flex-direction:column;min-height:104px}
.summary-stats>.stat>.label{min-height:2.4em;line-height:1.3}
.summary-stats>.stat>.value{margin-top:auto;font-variant-numeric:tabular-nums;line-height:1.15}

/* 2. Adjacent actions have purpose-specific group gaps. */
.hero-actions{gap:var(--layout-action-gap);margin-top:20px}
.training-shortcuts,
.profile-form-actions,
.settings-profile-actions,
.settings-install-actions,
.settings-backup-actions,
.session-top-actions,
.session-customize-actions,
.session-finish-actions{
  gap:var(--layout-action-gap);
}
.training-shortcuts{margin-bottom:4px}
.training-quick-card{gap:16px;align-items:center}
.training-quick-card>div:first-child{flex:1 1 210px;min-width:0}
.profile-form-actions{margin-top:20px}
.settings-profile-actions{display:flex;flex-wrap:wrap;align-items:center;margin-top:16px}
.settings-profile-actions>.button{margin:0}
.settings-install-actions>.button,
.settings-backup-actions>.button{margin:0}
.settings-install-actions{margin-top:14px}
.settings-backup-actions{margin-top:18px}
.settings-device-actions{display:flex;flex-wrap:wrap;gap:var(--layout-action-gap);padding-top:4px}
.settings-device-actions>.button{margin:0}

/* 3. Clear heading → detail → actions structure on Profile. */
.profile-mini-card{display:flex;flex-direction:column;align-items:flex-start;gap:0}
.profile-mini-card>h2{margin:0}
.profile-mini-card>.row{align-self:stretch;gap:12px;flex-wrap:wrap;margin:0}
.profile-mini-card>.hint,
.profile-privacy-card>.hint{margin-top:10px;margin-bottom:0;line-height:1.55}
.profile-mini-card .profile-card-actions{
  display:flex;
  flex-direction:column;
  align-items:flex-start;
  gap:var(--layout-compact-gap);
  margin-top:18px;
}
.profile-card-actions>.pill-link{
  display:inline-flex;
  align-items:center;
  min-height:32px;
  padding:3px 0;
}
.profile-privacy-card>h2{margin-bottom:0}
.profile-privacy-actions{
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  gap:var(--layout-action-gap);
  margin-top:18px;
}
.profile-privacy-actions>.button{margin:0}

/* 4. Consistent secondary actions within routine, history and exercise cards. */
.routine-card{gap:14px}
.routine-card>.routine-actions{
  display:grid;
  grid-template-columns:minmax(0,1fr);
  gap:var(--layout-compact-gap);
  margin-top:3px;
}
.routine-card>.routine-actions:has(>.button:nth-child(2)){
  grid-template-columns:repeat(2,minmax(0,1fr));
}
.routine-card>.routine-actions:has(>.button:nth-child(3)){
  grid-template-columns:repeat(3,minmax(0,1fr));
}
.routine-card>.routine-actions>.button{min-width:0;width:100%;margin:0}
.history-filter .filter-top{gap:16px}
.quick-filters{gap:var(--layout-compact-gap);margin:18px 0}
.quick-filters>.mini-action{margin:0}
.calendar-head>div{display:flex;gap:var(--layout-compact-gap)}
.exercise-row>.row{gap:var(--layout-compact-gap)}
.exercise-foot{gap:var(--layout-compact-gap);padding-block:14px}
.exercise-foot>.button{min-width:0;margin:0}
.exercise-controls{gap:8px}
.set-extras{gap:var(--layout-compact-gap)}
.session-customize-actions{margin-top:0}
.session-finish-actions{margin-top:20px}

/* 5. Modal footers retain a clear 16px separation between decisions. */
.modal-footer{
  gap:var(--layout-action-gap);
  margin-top:22px;
  padding-top:18px;
}
.modal-footer>.button{min-width:0;margin:0}

@media(max-width:580px){
  .overview-stats{gap:10px}
  .hero+.overview-stats{gap:10px}
  .hero+.overview-stats>.stat{
    min-height:107px;
    padding:13px 10px 12px;
  }
  .overview-stats>.stat>.label{font-size:11px;min-height:2.75em;line-height:1.375}
  .overview-stats>.stat>.value{font-size:23px;line-height:1.12;padding-top:8px}
  .hero-actions{gap:var(--layout-action-gap);margin-top:20px}
  .hero-actions>.button{min-height:46px}
  .profile-form-actions{display:grid;grid-template-columns:1fr;gap:var(--layout-compact-gap)}
  .profile-form-actions>.button{width:100%}
  .profile-privacy-actions{gap:var(--layout-action-gap)}
  .settings-profile-actions{gap:var(--layout-action-gap)}
  .training-quick-card{align-items:stretch}
  .training-quick-card>.button{flex:1 1 100%;width:100%}
  .exercise-foot{
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:var(--layout-compact-gap);
    padding:14px 12px;
  }
  .exercise-foot>.button{width:100%;min-height:44px;padding:9px 10px}
  .exercise-foot>.favorite-toggle{justify-self:end;align-self:center}
  .session-finish-actions{display:flex;flex-direction:column;align-items:stretch;gap:var(--layout-action-gap)}
  .session-finish-actions>.button{width:100%;min-height:46px}
  .session-customize-actions{width:100%}
  .session-customize-actions>.button{flex:1 1 125px}
  .modal-footer{gap:var(--layout-action-gap)}
}
@media(max-width:374px){
  /* 360px phones deserve two uncompressed 46px-tall hero actions. */
  .hero-actions{grid-template-columns:minmax(0,1fr)}
  .hero-actions>.button{width:100%;min-height:46px}
  .overview-stats>.stat>.value{font-size:22px}
  .modal-footer{flex-direction:column}
  .modal-footer>.button{flex:0 0 auto;width:100%;min-height:46px}
  .settings-install-actions>.button,.settings-backup-actions>.button{flex:1 1 100%}
}
