/* Shared visual language. Page styles still own grids, charts and interactions. */
:root {
  color-scheme: light;
  --app-bg: light-dark(#f4f7f4, #141b17);
  --app-panel: light-dark(#ffffff, #202923);
  --app-text: light-dark(#1a2920, #edf4ee);
  --app-muted: light-dark(#607266, #a6b9ac);
  --app-border: light-dark(#dfe7e1, #36463b);
  --app-soft: light-dark(#eaf2e9, #293e2f);
  --app-accent: light-dark(#376f43, #a4d6ae);
  --app-radius: 12px;
}
body.app-ui {
  --background-color: var(--app-bg); --card-background: var(--app-panel);
  --text-color: var(--app-text); --drawer-background: var(--app-panel);
  --cal-bg: var(--app-bg); --cal-panel: var(--app-panel); --cal-text: var(--app-text);
  --cal-muted: var(--app-muted); --cal-border: var(--app-border); --cal-soft: var(--app-soft); --cal-green: var(--app-accent);
  color-scheme: inherit;
  background: var(--app-bg); color: var(--app-text); font:14px/1.5 Inter,Arial,sans-serif;
}
body.app-ui :is(.card,.dashboard-section,.season-chart-card,.profile-section,.profile-zone-card,.week-day,.library-card) {
  box-sizing:border-box; background:var(--app-panel); color:var(--app-text);
  border:1px solid var(--app-border); border-radius:var(--app-radius); box-shadow:none;
}
body.app-ui :is(.season-overview,.week-overview,.dashboard-overview>div,.ctl-badge) {
  background:var(--app-soft); color:var(--app-text); border-color:var(--app-border); border-radius:var(--app-radius);
}
body.app-ui :is(.season-container,.dashboard-container,.profile-container,.week-container) p {color:var(--app-muted);}
body.app-ui :is(h1,h2,h3) {font-family:Inter,Arial,sans-serif; line-height:1.35;}
body.app-ui :is(button,input,select,textarea) {font-family:inherit; box-sizing:border-box;}
body.app-ui :is(input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=hidden]):not([type=submit]),select,textarea) {
  background:var(--app-panel); color:var(--app-text); border:1px solid var(--app-border); border-radius:8px; max-width:100%;
}
body.app-ui :is(.season-button,.dashboard-action,.dashboard-detail-toggle,.profile-date button,.profile-jumps a,.dashboard-jumps a) {
  background:var(--app-panel); color:var(--app-accent); border-color:var(--app-border); border-radius:8px;
}
body.app-ui :is(button,a,input,select,textarea,summary,[tabindex]):focus-visible {outline:2px solid var(--app-accent);outline-offset:3px;}
.site-header .calendar-appearance {display:flex;align-items:center;gap:8px;font:12px Inter,Arial,sans-serif;color:#c3d2c7;}
.calendar-mobile-nav {display:none;}
body.app-ui .site-header .calendar-appearance select {background:#26382c;color:#eef5ef;border-color:#425448;padding:8px;}
@media(max-width:768px) {
  body.app-ui {padding-bottom:90px;}
  body.app-ui .calendar-mobile-nav {position:fixed;display:flex;justify-content:space-around;bottom:0;left:0;right:0;z-index:20;background:var(--app-panel);border-top:1px solid var(--app-border);padding:9px 4px max(9px,env(safe-area-inset-bottom));}
  body.app-ui .calendar-mobile-nav a {display:flex;flex-direction:column;align-items:center;justify-content:center;gap:5px;min-height:44px;padding:5px 7px;color:var(--app-muted);font:11px Inter,Arial,sans-serif;text-decoration:none;}
  body.app-ui .calendar-mobile-nav a[aria-current] {background:var(--app-soft);border-radius:8px;color:var(--app-accent);}
  body.app-ui .coach-chat-widget {bottom:85px;right:18px;}
  body.app-ui :is(.container,.season-container,.dashboard-container,.profile-container,.week-container) {box-sizing:border-box;max-width:100%;padding-left:16px;padding-right:16px;}
  body.app-ui :is(.card,.dashboard-section,.season-chart-card,.profile-section,.profile-zone-card) {padding:16px;margin-bottom:16px;}
  body.app-ui h1 {font-size:24px;}
  body.app-ui h2 {font-size:19px;}
  body.app-ui h3 {font-size:17px;}
  body.app-ui :is(button,select,input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=hidden])) {min-height:44px;}
  body.app-ui :is(input,select,textarea) {font-size:16px;}
}

/* Existing deployed mobile shell shares the same appearance preference. */
body.app-ui #site-mobile-more {background:var(--app-panel);color:var(--app-text);border-color:var(--app-border);}
body.app-ui #site-mobile-more :is(a,button) {color:var(--app-accent);}
body.app-ui #site-mobile-more [aria-current=page] {background:var(--app-soft);}
@media(max-width:767px) {
 body.app-ui.site-mobile-ready .site-mobile-bar {background:var(--app-panel);border-color:var(--app-border);color:var(--app-accent);}
 body.app-ui .site-mobile-bar :is(a,button) {background:var(--app-panel);color:var(--app-accent);}
 body.app-ui .site-mobile-bar :is([aria-current=page],.site-mobile-section-active) {background:var(--app-soft);}
}

/* Shared top controls: readable dates, equal heights and a centered mobile column. */
.site-header .site-date-field {display:flex;flex-direction:column;gap:6px;min-width:0;text-align:left;font:12px/1.4 Inter,Arial,sans-serif;color:#a6b9ac;}
.site-header #date_range_div .site-date-range {align-items:end;gap:12px;}
body.app-ui .site-header #date_range_div .site-date-field input {width:164px;max-width:none;flex:none;}
body.app-ui .site-header #date_range_div :is(input,button) {height:48px;min-height:48px;margin:0;font-size:16px;border-radius:8px;}
@media(min-width:769px) {
 body.app-ui .date-navigation input[type=date] {width:164px;min-width:164px;}
}
@media(max-width:768px) {
 body.app-ui .site-header .header-top:has(.site-athlete-context) {display:flex;flex-wrap:wrap;row-gap:16px;}
 body.app-ui .site-athlete-context {order:2;flex-basis:100%;width:100%;max-width:440px;margin:0 auto;}
 body.app-ui .site-header .site-athlete-context select {width:100%;min-height:48px;height:48px;font-size:16px;}
 body.app-ui .site-header #date_range_div {display:block!important;flex:1 1 100%;width:100%!important;max-width:440px;margin:8px auto 0;overflow:visible;}
 body.app-ui .site-header #date_range_div .site-date-range {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));width:100%;gap:12px;align-items:end;}
 body.app-ui .site-header #date_range_div .site-date-field {width:100%;}
 body.app-ui .site-header #date_range_div .site-date-field input {width:100%;min-width:0;max-width:none;padding:10px;}
 body.app-ui .site-header #date_range_div .site-date-submit {grid-column:1/-1;width:100%;}
 body.app-ui .site-header #date_range_div :is(.site-range-back,.site-range-forward) {grid-row:2;width:100%;padding:10px;}
 body.app-ui .site-header #date_range_div .site-range-back {grid-column:1;}
 body.app-ui .site-header #date_range_div .site-range-forward {grid-column:2;}
 body.app-ui .date-navigation {box-sizing:border-box;width:100%;max-width:440px;margin:16px auto;}
 body.app-ui > .date-navigation {width:calc(100% - 32px);}
 body.app-ui .date-navigation form {display:grid;grid-template-columns:48px minmax(0,1fr) 48px;align-items:center;gap:12px;width:100%;margin:0;}
 body.app-ui .date-navigation :is(input[type=date],button) {box-sizing:border-box;width:100%;min-width:0;height:48px;margin:0;padding:10px;font-size:16px;line-height:1.25;}
 body.app-ui .profile-date {display:grid;grid-template-columns:minmax(0,1fr) auto;width:100%;max-width:440px;margin:8px auto 0;gap:8px 12px;align-items:center;}
 body.app-ui .profile-date label {grid-column:1/-1;text-align:left;}
 body.app-ui .profile-date :is(input,button) {width:100%;height:48px;margin:0;font-size:16px;}
 body.app-ui .calendar-navigation {display:flex;flex-direction:column;align-items:stretch;max-width:440px;margin:0 auto;}
 body.app-ui.calendar-redesign .site-header #date_range_div {display:none!important;}
 body.app-ui.calendar-redesign .site-header #toggle_buttons {margin:0 auto;}
 body.app-ui .calendar-athlete-context {order:-1;width:100%;max-width:none;}
 body.app-ui #calendar-athlete {max-width:none;height:48px;}
 body.app-ui .calendar-week-controls {width:100%;justify-content:center;gap:12px;}
 body.app-ui .calendar-date-controls {display:flex;justify-content:center;align-items:center;flex-basis:100%;gap:12px;margin:0;}
 body.app-ui .calendar-view-controls {width:100%;justify-content:center;gap:12px;}
 body.app-ui .calendar-navigation label {margin-left:0;}
 body.app-ui .calendar-key {flex-basis:100%;margin:0;text-align:center;}
 body.app-ui .calendar-navigation :is(button,input,select) {min-height:48px;height:48px;margin:0;}
 body.app-ui .week-scope-controls {justify-content:center;align-items:center;gap:12px;}
 body.app-ui .week-scope-controls :is(button,input,select) {min-height:48px;}
}
@media(max-width:359px) {
 body.app-ui .date-navigation form {grid-template-columns:44px minmax(0,1fr) 44px;gap:8px;}
 body.app-ui .site-header #date_range_div .site-date-field {grid-column:1/-1;}
 body.app-ui .site-header #date_range_div :is(.site-range-back,.site-range-forward) {grid-row:3;}
}

/* Appearance is a compact utility control, not a full-width form field. */
body.app-ui .site-header .calendar-appearance {justify-self:end;flex:0 0 auto;width:max-content;max-width:100%;white-space:nowrap;}
body.app-ui .calendar-appearance :is(select,#calendar-theme) {flex:0 0 auto;width:120px;min-width:100px;max-width:140px;}
@media(max-width:767px) {
 body.app-ui .site-mobile-bar :is(a,button) {font-size:14px;padding-left:4px;padding-right:4px;}
}
@media(max-width:399px) {
 body.app-ui .site-mobile-bar :is(a,button) {font-size:13px;}
}
