/* MT-009 shared structural layer. Semantic palette lives exclusively in tokens.css. */
html,body{background:var(--bg);color:var(--text);font-family:var(--font)}
body :is(h1,h2,h3,.brand,.session-duration,.stats strong,.week-facts strong,.day-number){font-family:var(--font);letter-spacing:normal}
body h1,.native-flow h1{font-size:28px;font-weight:700;line-height:1.2}
body :is(.app-shell,.native-flow,.api-shell,.today-shell,.week-shell,.me-shell){font-family:var(--font);color:var(--text);background-color:var(--bg)}
body .native-flow{width:min(100%,960px);padding-bottom:calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 32px)}
body :is(.api-card,.session-card,.provider-card,.audit-card,.plan-week,.day-hero,.wizard-review-row,.entry-email){background:var(--surface);color:var(--text);border-radius:var(--r-m);border-color:var(--line);box-shadow:var(--shadow)}
:root[data-theme=dark] body :is(.api-card,.session-card,.provider-card,.audit-card,.plan-week,.day-hero,.wizard-review-row){border-color:transparent;box-shadow:none}
body .button,body .native-flow .button{min-height:48px;border-radius:12px;padding:12px 16px;font-size:15px;font-weight:600;line-height:1.4;text-align:center;white-space:normal;overflow-wrap:anywhere}
body .button.primary,body .native-flow .button.primary{background:var(--accent);color:var(--on-accent);border-color:var(--accent)}
body .button.primary:hover,body .native-flow .button.primary:hover{background:var(--accent-press);color:var(--on-accent)}
body .button.secondary,body .native-flow .button.secondary{background:var(--secondary-bg);color:var(--secondary-text);border-color:var(--line)}
body :is(input,select,textarea){background:var(--surface-2);color:var(--text);border-color:var(--line)}
body :is(a,button,input,select,textarea,summary):focus-visible{outline:2px solid var(--accent);outline-offset:2px}
body .native-flow .wizard-days{display:grid;grid-template-columns:repeat(7,minmax(40px,1fr));gap:4px}
body .native-flow .wizard-days :is(label,span){width:100%;min-height:44px;border-radius:var(--r-s);font-size:12px;text-align:center}
body .native-flow .wizard-days input:checked+span,body .native-flow .wizard-choice[aria-pressed=true]{background:var(--accent);color:var(--on-accent);border-color:var(--accent)}
body .native-flow .wizard-pills{display:grid;grid-auto-columns:minmax(0,1fr);grid-auto-flow:column;gap:4px}
body .native-flow .wizard-pills .wizard-choice{min-width:0;min-height:48px;padding:8px;text-align:center;border-radius:var(--r-s);overflow-wrap:anywhere}
body :is(.app-navigation,.bottom-nav){position:fixed;inset:auto 0 0;transform:none;width:100%;max-width:none;min-height:calc(var(--tabbar-h) + env(safe-area-inset-bottom));padding:4px 8px calc(4px + env(safe-area-inset-bottom));display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:4px;background:var(--surface);border-top:1px solid var(--line);z-index:10}
body :is(.app-navigation>a,.bottom-nav>.bottom-tab){display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;min-height:56px;padding:4px;border:0;border-radius:var(--r-s);color:var(--text-3);background:transparent;text-decoration:none;font-size:11px;line-height:1.3;text-align:center;overflow-wrap:anywhere}
body :is(.app-navigation>a[aria-current=page],.bottom-nav>.bottom-tab.active){color:var(--accent-text);background:transparent;font-weight:600}
body :is(.app-navigation,.bottom-nav) svg{width:24px;height:24px;flex:none}
body .app-navigation :is(.app-navigation-brand,.app-navigation-profile),body .bottom-nav :is(.desktop-brand,.desktop-watch){display:none}
body .appearance-setting{display:grid;gap:8px;margin:24px 0;font-size:14px}.appearance-setting select{min-height:48px;width:100%;padding:12px;border:1px solid var(--line);border-radius:var(--r-s)}
body dialog{background:var(--surface);color:var(--text);border-color:var(--line);border-radius:var(--r-l)}body dialog::backdrop{background:var(--overlay)}
@media(max-width:360px){body .native-flow .wizard-days{grid-template-columns:repeat(4,minmax(40px,1fr))}body .native-flow .wizard-pills{grid-auto-flow:row;grid-template-columns:repeat(3,minmax(0,1fr))}}
@media(min-width:900px){
 body :is(.app-navigation,.bottom-nav){inset:0 auto 0 0;width:220px;min-height:100svh;padding:24px 16px;display:flex;flex-direction:column;align-items:stretch;border-top:0;border-right:1px solid var(--line)}
 body :is(.app-navigation>a,.bottom-nav>.bottom-tab){flex-direction:row;justify-content:flex-start;gap:12px;padding:12px;min-height:48px;font-size:15px}
 body .app-navigation .app-navigation-brand,body .bottom-nav .desktop-brand{display:flex;align-items:center;min-height:48px;font-size:22px;font-weight:700;color:var(--text);margin-bottom:24px}
 body .app-navigation .app-navigation-profile{display:flex;margin-top:auto}body .bottom-nav .desktop-watch{display:block;margin-top:auto;color:var(--text-2)}
 body:has(.app-navigation) .native-flow{margin-left:220px;width:calc(100% - 220px);max-width:none;padding:32px max(32px,calc((100% - 220px - 960px)/2));padding-bottom:40px}
 body:has(.app-navigation) .api-shell main,body:has(.bottom-nav) .api-shell main{margin-left:220px;max-width:1180px;padding:32px}
}
body :is(h2,h3),body dialog h2{font-weight:700}
body .native-flow .wizard-pills .wizard-choice{font-size:15px}
body .native-flow .wizard-pills .wizard-choice>span:first-child{overflow-wrap:normal;word-break:normal}
body .native-flow .wizard-pills:has([data-answer=frequency]){grid-template-columns:repeat(6,minmax(0,1fr));grid-auto-flow:row}
@media(max-width:360px){body .native-flow .wizard-pills:has([data-answer=days]){grid-template-columns:1fr}}
body .native-flow .wizard-pills:has([data-answer=frequency]){grid-template-columns:repeat(4,minmax(0,1fr))}
body .native-flow .wizard-pills .wizard-proposal-label{font-size:10px;overflow-wrap:normal;word-break:normal}
@media(max-width:360px){body .native-flow .wizard-pills:has([data-answer=frequency]){grid-template-columns:repeat(3,minmax(0,1fr))}}
body .native-flow .password-back{display:flex;align-items:center;min-height:48px;padding:12px 16px;margin:8px 0;background:var(--surface);color:var(--text);border-radius:var(--r-s);text-decoration:none;overflow-wrap:anywhere}

/* Claude M-16: explicit finish/time goal, using the existing segmented controls. */
body .native-flow .race-target-fields{border:0;padding:0;margin:20px 0;min-width:0;}
body .native-flow [data-race-target] .wizard-pills{grid-auto-flow:row;grid-template-columns:repeat(2,minmax(0,1fr));}
body .native-flow [data-race-target] .wizard-choice{font-size:15px;overflow-wrap:normal;word-break:normal;white-space:normal;}
body .native-flow .button.secondary.race-target-clear{background:transparent;border-color:transparent;color:var(--accent);}
body .native-flow [data-race-target-input][hidden],body .native-flow [data-race-target-clear][hidden]{display:none;}

/* M-16: textual verdict remains explicit in both themes. */
.goal-preview-verdict{font-weight:600;padding:12px;border:1px solid currentColor;border-radius:var(--r-s,8px)}
.goal-preview-realistic{color:color-mix(in srgb,var(--ok) 70%,var(--text))}
.goal-preview-ambitious{color:var(--warn-text,var(--text))}
.goal-preview-unrealistic{color:var(--bad-text,var(--text))}

/* Claude MT-009: archive import status, indeterminate progress and explicit retry. */
.watch-archive{margin-block:24px;padding:20px;background:var(--surface);border-radius:var(--r-m);box-shadow:var(--shadow)}
.watch-archive-heading{display:flex;align-items:center;justify-content:space-between;gap:12px}.watch-archive-heading h2{margin:0;font-size:20px;font-weight:700;line-height:1.3}
.watch-archive-status{display:flex;align-items:baseline;gap:8px;margin-bottom:0;color:var(--text-2);font-variant-numeric:tabular-nums}.watch-archive-dot{display:inline-block;flex:0 0 8px;width:8px;height:8px;border-radius:50%;background:var(--warn)}.watch-archive-status.is-failed .watch-archive-dot{background:var(--bad)}
.watch-archive-progress{display:block;width:100%;height:4px;margin-top:16px;border:0;border-radius:4px;accent-color:var(--accent)}
.watch-archive-refresh,.watch-archive-retry{border:0;background:transparent;color:var(--accent-text);font:inherit;cursor:pointer;min-height:44px;min-width:44px;padding:8px}.watch-archive-refresh{font-size:24px}.watch-archive-retry{margin-top:8px;padding-inline:0;text-decoration:underline;text-underline-offset:3px}.watch-archive-notice{color:var(--bad-text)}
:root[data-theme=dark] .watch-archive{box-shadow:none}

.watch-archive-progress::-webkit-progress-bar{background:var(--line);border-radius:4px}.watch-archive-progress::-webkit-progress-value{background:var(--accent);border-radius:4px}.watch-archive-progress:indeterminate{background:linear-gradient(90deg,var(--accent) 0 35%,var(--line) 35% 100%)}.watch-archive-progress:indeterminate::-webkit-progress-bar{background:transparent}.watch-archive-progress::-moz-progress-bar{background:var(--accent)}

.watch-page-header{display:flex;justify-content:space-between;align-items:center;gap:12px}.watch-more-link{display:inline-flex;align-items:center;min-height:44px;color:var(--accent-text);text-decoration:none}.watch-connected{font-weight:600}.watch-disconnect{margin-top:24px;padding-top:16px;border-top:1px solid var(--line)}body .native-flow .watch-unlink{background:transparent;color:var(--bad-text);border:0;box-shadow:none}

.watch-disconnect p{font-size:14px;line-height:1.5;color:var(--text-2)}

.watch-archive-sources{display:flex;flex-wrap:wrap;gap:8px;list-style:none;margin:12px 0 0;padding:0}.watch-archive-sources li{font-size:13px;line-height:1.4;padding:4px 8px;background:var(--surface-2);color:var(--text-2);border-radius:var(--r-s)}

/* Claude MT-004 review 31.10 09:05: one consistent public entry stack. */
.sign-in-shell .login-choice-stack{display:flex;flex-direction:column;align-items:stretch;gap:12px;width:100%}
body .sign-in-shell .login-choice-stack>.button{display:flex;align-items:center;justify-content:center;box-sizing:border-box;width:100%;min-height:48px;margin:0;border-radius:12px;padding:12px 16px}
body .sign-in-shell .login-choice-stack>.button.ghost{background:transparent;color:var(--accent-text);border:0;box-shadow:none;text-decoration:underline;text-underline-offset:3px}
body .sign-in-shell .sign-in .jen-login-avatar{display:grid;place-items:center;width:64px;height:64px;border-radius:50%;background:var(--accent);color:var(--on-accent);font:700 32px/1 var(--font)}

body .sign-in-shell .login-choice-stack>.button{gap:8px}body .sign-in-shell .login-choice-stack>.button.primary:not(:disabled){background:var(--accent);color:var(--on-accent);opacity:1}.sign-in-shell [data-login-waiting=true]::before{content:"";width:16px;height:16px;box-sizing:border-box;flex:none;border:2px solid currentColor;border-right-color:transparent;border-radius:50%;animation:login-spin .8s linear infinite}@keyframes login-spin{to{transform:rotate(360deg)}}@media(prefers-reduced-motion:reduce){.sign-in-shell [data-login-waiting=true]::before{animation:none}}
/* №186 «Sign in with Google»: neutral button, G mark (Google branding guidelines); colours live in tokens.css. */
.button.google-signin{display:inline-flex;align-items:center;justify-content:center;gap:12px;min-height:48px;width:100%;box-sizing:border-box;padding:0 16px;border:1px solid var(--google-line);border-radius:8px;background:var(--google-bg);color:var(--google-text);font-family:Roboto,system-ui,-apple-system,"Segoe UI",sans-serif;font-weight:500;font-size:14px;text-decoration:none;}
.button.google-signin:hover{background:var(--google-hover);}.button.google-signin .google-mark{flex:none;}
.google-or{display:flex;align-items:center;gap:12px;margin:16px 0;font-size:.875rem;opacity:.8;}.google-or::before,.google-or::after{content:"";flex:1;border-top:1px solid var(--line);}
.recovery-support{margin-top:24px;font-size:.875rem;overflow-wrap:anywhere;}

/* Claude №193 (Matvey 11–12): Mini App / phone shell uses the full screen width and height — no outer frame,
   only a 16px gutter widened by the safe areas; long words wrap inside their box; type scales with the screen. */
@media(max-width:640px){
 html,body{margin:0;padding:0;background:var(--bg)}
 body .native-flow{width:100%;max-width:none;min-height:100svh;margin:0;border:0;border-radius:0;box-shadow:none;
  padding-top:max(16px,env(safe-area-inset-top));padding-left:max(16px,env(safe-area-inset-left));padding-right:max(16px,env(safe-area-inset-right))}
 body .native-flow :is(.principal-season,.wizard-panel){padding-inline:0}
 body .api-shell.app-shell main{padding-left:max(16px,env(safe-area-inset-left));padding-right:max(16px,env(safe-area-inset-right))}
 body h1,body .native-flow h1{font-size:clamp(22px,6.6vw,28px)}
 body .native-flow h2{font-size:clamp(18px,5.2vw,22px)}
 body .native-plan .day-hero{border-radius:var(--r-l)}
}
:where(.native-flow,.app-shell,.api-shell) :where(*){min-width:0}
:where(.native-flow,.app-shell,.api-shell) :where(p,h1,h2,h3,h4,li,dt,dd,label,legend,summary,td,th,a,button,strong,small,span,time){overflow-wrap:anywhere}
:where(.native-flow,.app-shell,.api-shell) :where(img,svg,video){max-width:100%}
/* №193 (Matvey 12): a heading inside a settings card never touches the card edge. */
body .native-flow :is(.home-settings,.api-card)>header{padding:0}
body .native-flow .home-settings h1{margin:var(--sp-4) 0 var(--sp-2)}

/* Sport foundation — shared by website, Mini App and admin. */
html body{font-family:var(--font);font-size:16px;line-height:1.5}
html body :is(h1,h2,h3,.brand,.session-duration,.stats strong,.week-facts strong,.day-number){font-family:var(--font-heading);font-weight:700;letter-spacing:.5px;text-transform:uppercase}
html body h1,html body .native-flow h1{font-size:40px;line-height:1.1;overflow-wrap:anywhere}
html body :is(h2,h3){font-size:24px;line-height:1.2}
html body :is(.eyebrow,.overline){font:600 12px/1.4 var(--font);letter-spacing:1px;text-transform:uppercase}
html body .button,html body .native-flow .button,html body .sign-in-shell .login-choice-stack>.button{min-height:50px;border-radius:25px;padding:12px 20px;font:600 15px/1.4 var(--font)}
html body .button.primary,html body .native-flow .button.primary{min-height:56px;border-radius:28px;background:var(--accent);color:var(--on-accent);font-size:16px}
html body .button.secondary,html body .native-flow .button.secondary{background:transparent;color:var(--text);border:1px solid var(--line)}
html body :is(input:not([type=checkbox]):not([type=radio]):not([type=range]),select,textarea){font-family:var(--font);font-size:16px;min-height:50px;border-radius:var(--r-s)}
html body :is(.wizard-choice,.wizard-days span){min-height:44px;border-radius:22px}
html body :is(.api-card,.session-card,.provider-card,.audit-card,.plan-week,.day-hero,.wizard-review-row,.entry-email){border-radius:var(--r-m);background:var(--surface)}
html body .native-flow{width:min(100%,480px);margin-inline:auto;padding:20px 20px calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 20px)}
html body :is(.app-navigation,.bottom-nav){inset:auto 0 0;width:min(100%,480px);max-width:480px;margin-inline:auto;min-height:calc(var(--tabbar-h) + env(safe-area-inset-bottom));display:grid;grid-template-columns:repeat(4,minmax(0,1fr));padding:8px 8px calc(8px + env(safe-area-inset-bottom));border:0;border-top:1px solid var(--line);background:var(--bg)}
html body :is(.app-navigation>a,.bottom-nav>.bottom-tab){flex-direction:column;justify-content:center;min-height:48px;font-size:11px;gap:4px;padding:4px}
html body .app-navigation :is(.app-navigation-brand,.app-navigation-profile),html body .bottom-nav :is(.desktop-brand,.desktop-watch){display:none}
html body:has(.app-navigation) .native-flow{width:min(100%,480px);max-width:480px;margin-inline:auto;padding:20px 20px calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 20px)}
html body:has(.app-navigation) .api-shell main,html body:has(.bottom-nav) .api-shell main{width:min(100%,480px);max-width:480px;margin-inline:auto;padding:20px 20px calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 20px)}
html body .admin :is(button,.btn){min-height:44px;border-radius:22px}
html body .appearance-setting{display:none}

/* R0: compact public entry; readiness controls keep their existing handlers. */
html body .sign-in-shell{max-width:480px;margin-inline:auto;padding:20px;background:var(--bg)}
html body .sign-in-shell .sign-in-controls{position:static;display:flex;justify-content:flex-end;min-height:44px;margin:0 0 20px;padding:0}
html body .sign-in-shell main{padding:0;margin:0;width:100%;max-width:none}
html body .sign-in-shell .page-heading{margin:0 0 20px}
html body .sign-in-shell .sign-in{max-width:none;margin:0;padding:20px;border-radius:20px}
html body .sign-in-shell .login-choice-stack [hidden]{display:none}
.sport-email-link{display:flex;align-items:center;justify-content:center;min-height:44px;font-size:14px;color:var(--text-2);text-decoration:underline;text-underline-offset:4px}

html body .api-shell.sign-in-shell .page-heading h1{font:700 40px/1.1 var(--font-heading);letter-spacing:.5px;text-transform:uppercase}
html body .sign-in-shell .entry-intro{font:400 16px/1.5 var(--font)}

/* Sport intake and nutrition choices retain original values and consent. */
html body .native-flow .wizard-progress{display:flex;gap:12px;align-items:center;font-size:13px;color:var(--text-2);text-transform:uppercase;letter-spacing:1px}
.wizard-progress progress{height:6px;accent-color:var(--accent);flex:1;min-width:40px}
html body .native-flow .wizard-choices{display:grid;grid-template-columns:minmax(0,1fr);gap:8px}
html body .native-flow .wizard-choices .wizard-choice{min-height:92px;border-radius:16px;padding:14px;background:var(--surface);border:1px solid var(--line);color:var(--text);text-align:left;font:700 24px/1.15 var(--font-heading)}
html body .native-flow .wizard-choice[aria-pressed=true]{border:2px solid var(--accent);color:var(--accent);background:var(--surface)}
html body [data-nutrition-form]{display:grid;gap:12px}
html body [data-nutrition-form]>label{display:grid;gap:12px;padding:16px;border:1px solid var(--line);border-radius:16px;background:var(--surface);font-size:15px}
.nutrition-chips,.nutrition-tags{display:flex;flex-wrap:wrap;gap:8px}
.nutrition-chip,.nutrition-tag{min-height:44px;border-radius:22px;border:1px solid var(--line);padding:10px 14px;background:var(--bg);color:var(--text);font:500 13px/1.4 var(--font);text-align:left}
.nutrition-chip[aria-pressed=true]{background:var(--text);color:var(--bg);border-color:var(--text)}
.nutrition-add{display:flex;gap:8px;align-items:center}.nutrition-add input{min-width:0;flex:1}.nutrition-add .button{flex:0 0 50px}
html body .acquaintance-nutrition summary{min-height:56px;padding:16px;border-radius:16px;border:1px solid var(--line);font-weight:600;color:var(--accent)}

.sport-nutrition-heading{display:flex;justify-content:space-between;align-items:center;gap:12px}.sport-nutrition-heading h1{flex:1}
/* Explicit ink for nested morning examples after the sport palette migration. */
body .native-entry .morning-preview{background:var(--surface);color:var(--text);border:1px solid var(--line);border-radius:20px}body .native-entry .morning-preview .preview-message{background:var(--bg);color:var(--text)}

/* Keep sport choice labels readable at the 480px shell width. */
html body .native-flow .wizard-choices .wizard-choice{overflow-wrap:normal;word-break:normal;gap:12px}
html body .native-flow .wizard-choices .wizard-icon,html body .native-flow .wizard-choices .wizard-check{flex:none}
html body .native-flow .wizard-choices .wizard-check{margin-left:auto}

.sport-call-avatar{width:96px;height:96px;border:2px solid var(--accent);border-radius:50%;display:grid;place-items:center;font:700 48px var(--font-heading);color:var(--accent);margin:32px auto}.sport-call-actions{display:grid;gap:16px}.call-screen audio{width:100%;margin-top:20px}
.sport-nutrition-heading{display:flex;align-items:center;justify-content:space-between;gap:16px;flex-wrap:wrap}.nutrition-language{position:relative}.nutrition-language summary{cursor:pointer;list-style:none}.nutrition-language[open]{width:100%}.nutrition-language .nutrition-chips{margin-top:12px}
