/* ======================================================================
   GritHQ Alpha4.71 — cohesive primary-tab theme
   Goal: carry the approved Home visual language across Home / Train /
   Progress / Profile without changing workout, Health, or data contracts.
   ====================================================================== */
:root{
  --gh471-bg:#040a12;
  --gh471-panel:#07131f;
  --gh471-panel-2:#091724;
  --gh471-panel-3:#0b1a28;
  --gh471-line:rgba(101,132,162,.30);
  --gh471-line-soft:rgba(101,132,162,.20);
  --gh471-text:#f4f7fa;
  --gh471-muted:#94a4b5;
  --gh471-blue:#2d94ff;
  --gh471-cyan:#2bcbd8;
  --gh471-lime:#77d944;
  --gh471-violet:#9a62e8;
  --gh471-amber:#f0b23e;
  --gh471-orange:#f07b46;
  --gh471-rose:#eb5b91;
  --gh471-teal:#29b9ae;
}

/* ---------- shared shell ---------- */
@media(max-width:959px){
  .mobile-appbar{
    min-height:64px!important;
    padding:calc(8px + env(safe-area-inset-top)) max(14px,env(safe-area-inset-right)) 8px max(14px,env(safe-area-inset-left))!important;
    background:rgba(3,9,16,.96)!important;
    border-bottom:1px solid rgba(104,137,169,.15)!important;
    box-shadow:0 8px 26px rgba(0,0,0,.14)!important;
  }
  .mobile-brand-row .brand-logo-img{width:142px!important;max-width:142px!important;height:auto!important}
  .global-coach-btn{
    width:50px!important;height:50px!important;padding:1px!important;
    border:1px solid rgba(66,157,238,.62)!important;
    background:radial-gradient(circle at 50% 42%,rgba(66,114,194,.22),rgba(7,16,28,.98) 64%)!important;
    box-shadow:0 0 0 1px rgba(126,71,211,.13),0 5px 18px rgba(0,0,0,.30)!important;
  }
  .global-coach-btn img{width:100%!important;height:100%!important;object-fit:contain!important;filter:none!important}

  body:not(.workout-mode) .bottom-nav{
    background:rgba(4,11,19,.975)!important;
    border-color:rgba(97,128,159,.32)!important;
    box-shadow:0 10px 30px rgba(0,0,0,.34)!important;
  }
  .bottom-nav .nav-btn{color:#8d9cab!important}
  .bottom-nav .nav-btn.active{box-shadow:inset 0 0 0 1px rgba(78,148,218,.28)!important}
  .bottom-nav .nav-btn[data-view="home"].active{color:var(--gh471-blue)!important;background:rgba(45,148,255,.10)!important}
  .bottom-nav .nav-btn[data-view="routines"].active{color:var(--gh471-cyan)!important;background:rgba(43,203,216,.08)!important}
  .bottom-nav .nav-btn[data-view="history"].active{color:var(--gh471-lime)!important;background:rgba(119,217,68,.08)!important}
  .bottom-nav .nav-btn[data-view="profile"].active{color:var(--gh471-violet)!important;background:rgba(154,98,232,.09)!important}
}

/* ---------- shared primary page language ---------- */
#view-routines,#view-history,#view-profile{
  color:var(--gh471-text);
}
#view-routines .card,#view-history .card,#view-profile .gh-profile-row,#view-profile .gh-profile-quick{
  background:linear-gradient(150deg,rgba(9,23,36,.98),rgba(5,15,25,.99))!important;
  border-color:var(--gh471-line)!important;
  box-shadow:0 9px 22px rgba(0,0,0,.14),inset 0 1px 0 rgba(255,255,255,.02)!important;
}
#view-routines .section-title-row h2,#view-history .section-title-row h2,#view-profile .gh-profile-head h2{
  color:var(--gh471-text)!important;letter-spacing:-.04em!important;
}
#view-routines .section-title-row .subtle,#view-history .section-title-row .subtle,#view-profile .gh-profile-head .subtle{
  color:var(--gh471-muted)!important;
}

/* ---------- HOME ---------- */
@media(max-width:959px){
  /* Keep the shared header/dock rows, but Home is a normal touch-scroll surface.
     The small bottom breathing room intentionally prevents the page from feeling
     mechanically frozen when its core dashboard fits the viewport. */
  body.home-mode .main-content,html.ios-standalone body.home-mode .main-content,body.home-mode:not(.home-expanded) .main-content,html.ios-standalone body.home-mode:not(.home-expanded) .main-content{
    overflow-y:auto!important;overflow-x:hidden!important;
    overscroll-behavior-y:auto!important;touch-action:pan-y!important;
    -webkit-overflow-scrolling:touch!important;
  }
  body.home-mode .gh-home-v2{padding-bottom:22px!important;min-height:calc(100% + 18px)!important}
}

.gh-home-v2-plan.plan-setup:before{display:none!important}
.gh-home-v2-plan.plan-setup:after{background:linear-gradient(125deg,rgba(7,18,29,.99),rgba(8,22,35,.96))!important}
.gh-home-v2-plan.plan-calisthenics:before{background-image:url('../../assets/plan-calisthenics-v1.webp')!important;background-position:55% 28%!important}
.gh-home-v2-plan.plan-strength:before{background-image:url('../../assets/plan-strength-v1.webp')!important;background-position:52% 28%!important}
.gh-home-v2-plan.plan-cardio:before{background-image:url('../../assets/plan-cardio-v1.webp')!important;background-position:50% 34%!important}
.gh-home-v2-plan.plan-hybrid:before{background-image:url('../../assets/plan-hybrid-v1.webp')!important;background-position:52% 28%!important}
.gh-home-v2-plan.plan-mobility:before{background-image:url('../../assets/plan-mobility-v1.webp')!important;background-position:52% 30%!important}
.gh-home-v2-plan.plan-recovery:before{background-image:url('../../assets/plan-recovery-v1.webp')!important;background-position:50% 32%!important}
.gh-home-v2-plan:not(.plan-setup):before{opacity:.48!important;filter:saturate(.84) contrast(1.04)!important}
.gh-home-v2-plan:not(.plan-setup):after{background:linear-gradient(90deg,rgba(6,17,28,.99) 0%,rgba(6,17,28,.96) 47%,rgba(6,17,28,.62) 69%,rgba(6,17,28,.20) 100%)!important}

.gh-home-v2-recovery-metric{
  appearance:none!important;border:0!important;background:transparent!important;color:inherit!important;
  font:inherit!important;cursor:pointer!important;border-radius:11px!important;
  transition:background .15s ease,transform .15s ease!important;
}
.gh-home-v2-recovery-metric:active{transform:scale(.975)}
.gh-home-v2-recovery-metric:hover,.gh-home-v2-recovery-metric:focus-visible{background:rgba(255,255,255,.025)!important;outline:none!important}
.gh-home-v2-recovery-metric:focus-visible{box-shadow:inset 0 0 0 1px rgba(87,148,205,.36)!important}
.gh-home-v2-health-btn{
  min-height:42px!important;margin-left:11px!important;padding:0 12px!important;border-radius:10px!important;
  border:1px solid rgba(56,146,224,.42)!important;background:rgba(30,87,137,.08)!important;
  color:#78bdf7!important;font-size:11px!important;font-weight:780!important;white-space:nowrap!important;
}
.gh-home-v2-health-btn:active{transform:scale(.975)}
.gh-home-v2-quick-head{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:10px}
.gh-home-v2-quick-head .gh-home-v2-section-title{margin-bottom:0!important}
.gh-home-v2-customize{appearance:none;border:0;background:transparent;color:#67b3f5;font-size:11px;font-weight:800;letter-spacing:.01em;padding:5px 0;cursor:pointer}
.gh-home-v2-customize:after{content:' ›';font-size:13px}
.gh-home-v2-action{position:relative!important}
.gh-home-v2-action em{
  position:absolute;top:7px;right:7px;font-style:normal;font-size:11px;line-height:1;padding:3px 5px;border-radius:999px;
  color:#7fa0bc;background:rgba(77,110,142,.12);border:1px solid rgba(92,125,157,.18);letter-spacing:.03em;text-transform:uppercase;
}
.gh-home-v2-action.timer{color:var(--gh471-orange)!important;border-color:rgba(240,123,70,.38)!important}
.gh-home-v2-action.mobility{color:var(--gh471-amber)!important;border-color:rgba(240,178,62,.38)!important}
.gh-home-v2-action.log{color:var(--gh471-cyan)!important;border-color:rgba(43,203,216,.36)!important}
.gh-home-v2-action.checkin{color:var(--gh471-violet)!important;border-color:rgba(154,98,232,.36)!important}
.gh-home-v2-action.health{color:var(--gh471-lime)!important;border-color:rgba(119,217,68,.34)!important}
.gh-home-v2-action.nutrition{color:var(--gh471-teal)!important;border-color:rgba(41,185,174,.34)!important}
.gh-home-v2-action.train{color:var(--gh471-blue)!important;border-color:rgba(45,148,255,.34)!important}
.gh-home-v2-customize-dialog .sheet-card{max-width:480px}
.gh-home-v2-customize-slots{display:grid;gap:10px;margin:14px 0}
.gh-home-v2-customize-slots label{display:grid;grid-template-columns:72px minmax(0,1fr);gap:10px;align-items:center;color:#cdd7e0;font-size:12px}
.gh-home-v2-customize-slots select{min-height:46px;border-radius:11px;border:1px solid var(--gh471-line);background:#07131f;color:#f2f6f9;padding:0 11px;font-size:14px}
.gh-home-v2-customize-note{display:grid;gap:3px;margin:4px 0 14px;padding:11px;border:1px solid var(--gh471-line-soft);border-radius:11px;background:rgba(9,24,38,.56)}
.gh-home-v2-customize-note strong{font-size:11px;color:#dce6ee}.gh-home-v2-customize-note span{font-size:10px;line-height:1.35;color:var(--gh471-muted)}
.gh-focus-flash{animation:gh471FocusFlash 1.3s ease both}
@keyframes gh471FocusFlash{0%,100%{box-shadow:inherit}35%{box-shadow:0 0 0 2px rgba(45,148,255,.55),0 0 26px rgba(45,148,255,.18)}}

/* ---------- TRAIN ---------- */
#view-routines .workout-library-title{margin-bottom:9px!important}
#view-routines .gh-six-lanes{gap:9px!important;margin:8px 0 12px!important}
#view-routines .gh-six-lanes .gh-lane-switch{
  min-height:82px!important;border-radius:14px!important;background:linear-gradient(150deg,#091724,#07121d)!important;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.02)!important;
}
#view-routines .gh-six-lanes .gh-lane-switch-icon{
  width:34px!important;height:34px!important;border-radius:10px!important;
  box-shadow:none!important;background:rgba(255,255,255,.018)!important;
}
#view-routines .gh-six-lanes .gh-lane-switch-icon svg{filter:none!important;stroke-width:1.9!important}
#view-routines .gh-lane-switch.mobility .gh-lane-switch-icon svg,.gh-home-v2-action.mobility>span svg{stroke-width:2.05!important}
#view-routines .gh-six-lanes .gh-lane-switch.active{
  border-color:var(--gh-mode-accent,currentColor)!important;
  background:linear-gradient(150deg,color-mix(in srgb,var(--gh-mode-accent,currentColor) 9%,#091724),#07121d)!important;
  box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--gh-mode-accent,currentColor) 20%,transparent),0 8px 20px rgba(0,0,0,.13)!important;
}
#view-routines .gh-six-lanes .gh-lane-switch.active:after{
  content:'';position:absolute;bottom:7px;width:24px;height:2px;border-radius:4px;background:var(--gh-mode-accent,currentColor);opacity:.85;
}
#view-routines .gh-six-lanes .gh-lane-switch{position:relative!important}

#view-routines .training-mode-intro{
  min-height:205px!important;padding:18px!important;border-radius:17px!important;border-color:rgba(78,116,151,.38)!important;
  background:var(--gh471-panel)!important;justify-content:flex-end!important;
}
#view-routines .training-mode-intro::before{right:0!important;top:0!important;width:50%!important;height:100%!important;opacity:.52!important;filter:saturate(.86) contrast(1.04)!important;background-size:cover!important;background-position:center 30%!important}
#view-routines .training-mode-intro.calisthenics::before{background-image:url('../../assets/plan-calisthenics-v1.webp')!important}
#view-routines .training-mode-intro.strength::before{background-image:url('../../assets/plan-strength-v1.webp')!important}
#view-routines .training-mode-intro.cardio::before{background-image:url('../../assets/plan-cardio-v1.webp')!important}
#view-routines .training-mode-intro.hybrid::before{background-image:url('../../assets/plan-hybrid-v1.webp')!important}
#view-routines .training-mode-intro.mobility::before{background-image:url('../../assets/plan-mobility-v1.webp')!important}
#view-routines .training-mode-intro.recovery::before{background-image:url('../../assets/plan-recovery-v1.webp')!important}
#view-routines .training-mode-intro::after{background:linear-gradient(90deg,rgba(7,19,30,.99) 0%,rgba(7,19,30,.97) 47%,rgba(7,19,30,.60) 72%,rgba(7,19,30,.18) 100%)!important}
#view-routines .training-mode-intro>div{max-width:64%!important}
#view-routines .training-mode-intro h2{font-size:25px!important;line-height:1.06!important;margin:4px 0 7px!important;max-width:15ch!important}
#view-routines .training-mode-intro .subtle{font-size:11.5px!important;line-height:1.38!important;color:#9aabba!important;max-width:34ch!important}
#view-routines .training-mode-intro .primary{
  min-height:44px!important;min-width:0!important;margin-top:12px!important;border-radius:11px!important;padding:0 14px!important;
  background:linear-gradient(135deg,#1f77df,#1761bf)!important;border:1px solid rgba(76,160,240,.64)!important;color:#fff!important;box-shadow:0 4px 14px rgba(23,97,191,.18)!important;
}
#view-routines .gh-train-saved,#view-routines .gh-train-library{padding:13px!important;border-radius:15px!important}
#view-routines .gh-mini-panel-head{margin-bottom:10px!important}
#view-routines .gh-mini-panel-head>span{background:rgba(45,148,255,.10)!important;color:#72b8f7!important;border-color:rgba(45,148,255,.18)!important}
#view-routines .gh-compact-routines>.empty{min-height:74px!important;padding:18px 12px!important;display:grid;place-items:center!important;text-align:center!important}

/* ---------- PROGRESS ---------- */
#view-history .progress-page-head{margin-bottom:10px!important}
#view-history .progress-area-tabs{border-color:var(--gh471-line)!important;background:rgba(7,18,29,.78)!important;border-radius:15px!important}
#view-history .progress-area-tab{border-radius:11px!important}
#view-history .progress-area-tab.active{background:rgba(45,148,255,.075)!important;box-shadow:inset 0 0 0 1px rgba(73,147,220,.26)!important}
#view-history .gh-progress-overview-grid{gap:10px!important}
#view-history .gh-progress-summary-card,#view-history .gh-progress-metric-card,#view-history .gh-progress-trend-card{border-radius:16px!important;padding:13px!important}
#view-history .gh-neon-icon{box-shadow:none!important;background:rgba(255,255,255,.018)!important}
#view-history .gh-neon-icon.amber{color:var(--gh471-amber)!important}
#view-history .gh-neon-icon.violet{color:var(--gh471-violet)!important}
#view-history .gh-neon-icon.lime{color:var(--gh471-lime)!important}
#view-history .gh-neon-icon.rose{color:var(--gh471-rose)!important}
#view-history .gh-neon-icon.cyan{color:var(--gh471-cyan)!important}
#view-history .gh-big-number.lime{color:var(--gh471-lime)!important}
#view-history .gh-big-number.rose{color:var(--gh471-rose)!important}
#view-history .gh-progress-summary-card.wins .gh-summary-lines strong{color:#f2f5f8!important}
#view-history .gh-progress-summary-card.patterns .gh-summary-lines strong{color:#c88cf0!important}
#view-history .gh-progress-metric-card{min-height:142px!important}
#view-history .gh-pr-bars i{background:linear-gradient(180deg,#ef6b9e,#a85dea)!important}
#view-history .gh-pr-empty,#view-history .gh-progress-empty-trend{display:grid;place-items:center;text-align:center;color:#8293a4;font-size:11px;line-height:1.35;border:1px dashed rgba(102,133,163,.22);border-radius:11px;background:rgba(5,15,25,.30)}
#view-history .gh-pr-empty{min-height:42px;margin-top:12px;padding:8px}
#view-history .gh-progress-trend-card{min-height:0!important}
#view-history .gh-progress-trend-card.is-empty{padding-bottom:13px!important}
#view-history .gh-progress-empty-trend{min-height:78px;padding:14px;margin-top:8px}
#view-history .gh-progress-trend-card:not(.is-empty) .chart-wrap{height:135px!important;min-height:135px!important}

/* ---------- PROFILE ---------- */
#view-profile .gh-profile-head{margin-bottom:12px!important}
#view-profile .profile-avatar{
  width:52px!important;height:52px!important;border-radius:50%!important;
  border:1px solid rgba(68,151,226,.46)!important;background:radial-gradient(circle at 45% 35%,rgba(43,117,185,.30),rgba(6,16,27,.98) 68%)!important;
  box-shadow:none!important;color:#8ec8f8!important;font-size:15px!important;
}
#view-profile .gh-profile-grid{gap:9px!important}
#view-profile .gh-profile-row{min-height:72px!important;grid-template-columns:44px minmax(0,1fr) 18px!important;padding:10px 12px!important;border-radius:15px!important}
#view-profile .gh-profile-row-icon,#view-profile .gh-profile-quick>span{
  width:40px!important;height:40px!important;border-radius:11px!important;
  box-shadow:none!important;background:rgba(255,255,255,.018)!important;border:1px solid currentColor!important;
}
#view-profile .gh-profile-row-icon svg,#view-profile .gh-profile-quick>span svg{width:21px!important;height:21px!important;stroke-width:1.8!important}
#view-profile .gh-profile-row-icon.training{color:var(--gh471-blue)!important}
#view-profile .gh-profile-row-icon.equipment{color:var(--gh471-cyan)!important}
#view-profile .gh-profile-row-icon.goals{color:var(--gh471-amber)!important}
#view-profile .gh-profile-row-icon.injury{color:var(--gh471-rose)!important}
#view-profile .gh-profile-row-icon.training{border-color:currentColor!important}
#view-profile .gh-profile-row-icon.equipment{border-color:currentColor!important}
#view-profile .gh-profile-row-icon.goals{border-color:currentColor!important}
#view-profile .gh-profile-row-icon.injury{border-color:currentColor!important}
#view-profile .gh-profile-quick.health>span{color:var(--gh471-lime)!important}
#view-profile .gh-profile-quick.nutrition>span{color:var(--gh471-teal)!important}
#view-profile .gh-profile-quick.settings>span{color:var(--gh471-violet)!important}
#view-profile .gh-profile-row strong{font-size:14.5px!important}
#view-profile .gh-profile-row small{font-size:11px!important;color:var(--gh471-muted)!important}
#view-profile .gh-profile-quick-grid{gap:9px!important;margin-top:10px!important}
#view-profile .gh-profile-quick{min-height:102px!important;padding:12px!important;border-radius:15px!important;grid-template-rows:auto auto 1fr!important;gap:5px!important}
#view-profile .gh-profile-quick.settings.wide{min-height:82px!important;grid-template-columns:42px minmax(0,1fr)!important;grid-template-rows:auto auto!important;align-items:center!important;column-gap:11px!important}
#view-profile .gh-profile-quick.settings.wide>span{grid-row:1/3!important}
#view-profile .gh-profile-quick.settings.wide strong{align-self:end!important}
#view-profile .gh-profile-quick.settings.wide small{align-self:start!important}

@media(max-width:520px){
  #view-routines .gh-six-lanes{grid-template-columns:repeat(2,minmax(0,1fr))!important}
  #view-routines .gh-six-lanes .gh-lane-switch{min-height:74px!important;display:grid!important;grid-template-columns:32px minmax(0,1fr)!important;justify-items:stretch!important;align-content:center!important;text-align:left!important;padding:9px 11px!important;gap:9px!important}
  #view-routines .gh-six-lanes .gh-lane-switch-copy{align-items:flex-start!important}
  #view-routines .gh-six-lanes .gh-training-mode-control-label{font-size:11.5px!important;text-align:left!important;margin:0!important;max-width:none!important}
  #view-routines .gh-six-lanes .gh-lane-switch.active:after{left:11px;bottom:6px;width:20px!important}
  #view-routines .training-mode-intro{min-height:196px!important;padding:16px!important}
  #view-routines .training-mode-intro>div{max-width:66%!important}
  #view-routines .training-mode-intro h2{font-size:22px!important}
  #view-routines .training-mode-intro .subtle{font-size:11px!important;line-height:1.35!important}
  #view-routines .training-mode-intro .primary{font-size:11px!important;max-width:210px!important}

  #view-history .gh-summary-head h3{font-size:13.5px!important}
  #view-history .gh-summary-head p{font-size:11px!important}
  #view-history .gh-summary-lines span,#view-history .gh-summary-lines strong{font-size:11px!important}
  #view-history .gh-progress-metric-card{min-height:137px!important}
  #view-history .gh-progress-trend-card:not(.is-empty) .chart-wrap{height:112px!important;min-height:112px!important}
}

@media(max-width:390px){
  .mobile-brand-row .brand-logo-img{width:136px!important;max-width:136px!important}
  .global-coach-btn{width:48px!important;height:48px!important}
  #view-routines .gh-six-lanes .gh-training-mode-control-label{font-size:11px!important}
  #view-profile .gh-profile-row{min-height:70px!important}
  #view-profile .gh-profile-quick{min-height:98px!important}
  .gh-home-v2-action em{font-size:11px!important;padding:3px 4px!important}
}

/* Canonical Mobility & Flexibility pose, traced from the approved mockup. */
.gh-mobility-pose-icon{display:block!important;width:72%!important;height:72%!important;object-fit:contain!important;filter:none!important}
#view-routines .gh-lane-switch.mobility .gh-mobility-pose-icon{width:24px!important;height:24px!important;margin:auto!important}
.gh-home-v2-action.mobility>span .gh-mobility-pose-icon{width:25px!important;height:25px!important;margin:auto!important}
