/* P5-03 · token-migration phase 3 pilot. Theme-invariant literals now map to
   --md-* roles (--md-primary == brand in every theme; --md-on-primary constant).
   Auth-surface literals stay put: body.tl-auth is light-fixed by design. */
/* Shared TempoLife visual and motion rules. No layout animation or backdrop blur. */
:root {
  --ui-space-6:32px;
  --ui-motion-press:120ms;
  --ui-motion-choice:180ms;
  --ui-motion-sheet:260ms;
  --ui-motion-total:380ms;
  --ui-motion-milestone:640ms;
  --tl-ink:var(--t1,#18243b);
  --tl-muted:var(--t2,#58677c);
  --tl-surface:var(--surface,#fff);
  --tl-line:var(--border,#dce3ec);
  --tl-accent:var(--brand,#2563eb);
  --tl-soft:var(--brand-l,#edf3ff);
}
body { --ui-ease:cubic-bezier(.2,.8,.2,1); }
:where(button,a,input,select,textarea,summary):focus-visible { outline:3px solid var(--tl-accent);outline-offset:3px; }
:where(button,input,select,textarea) { font-family:inherit; }
:where(.btn,.tl-tools-primary,.daily-momentum-primary,.q-cta) {
  transition:background-color var(--ui-motion-press),border-color var(--ui-motion-press),transform var(--ui-motion-press) var(--ui-ease);
}
:where(.btn,.tl-tools-primary,.daily-momentum-primary,.q-cta):active:not(:disabled) { transform:scale(.985); }
.tl-rhythm { display:flex;align-items:center;justify-content:center;gap:8px;height:72px;color:var(--tl-accent);flex-shrink:0; }
.tl-rhythm i { display:block;width:14px;height:32px;border-radius:8px;background:currentColor;transform-origin:center; }
.tl-rhythm i:nth-child(2),.tl-rhythm i:nth-child(4) { height:52px;opacity:.7; }
.tl-rhythm i:nth-child(3) { height:72px; }
.tl-rhythm i:first-child,.tl-rhythm i:last-child { opacity:.4; }
.tl-rhythm--small { height:28px;gap:4px; }
.tl-rhythm--small i { width:5px;height:12px;border-radius:4px; }
.tl-rhythm--small i:nth-child(2),.tl-rhythm--small i:nth-child(4) { height:20px; }
.tl-rhythm--small i:nth-child(3) { height:28px; }

/* Welcome and account access retain the same auth forms and recovery paths. */
body.tl-auth { display:flex;flex-direction:column;gap:24px;min-height:100dvh;background:#f4f6fa;padding:32px 20px;color:var(--tl-ink); }
.tl-auth>.card { width:100%;max-width:440px;padding:28px;border:1px solid #e4e9f1;border-radius:24px;box-shadow:0 12px 48px #172a4810; }
.tl-auth .logo { justify-content:center;margin-bottom:24px; }
.tl-auth .logo-icon { width:36px;height:36px;border-radius:10px; }
.tl-auth .logo-text { font-size:20px;letter-spacing:-.5px; }
.tl-auth .logo-sub { display:none; }
.tl-welcome-art { height:160px;display:grid;place-items:center;border-radius:20px;background:#edf3ff;position:relative;margin:0 0 24px;overflow:hidden; }
.tl-welcome-art:before,.tl-welcome-art:after { content:'';position:absolute;width:128px;height:128px;border:1px solid #d8e5fc;border-radius:50%; }
.tl-welcome-art:before { left:-52px;top:-48px; }
.tl-welcome-art:after { right:-48px;bottom:-58px; }
.tl-auth h1 { font-size:32px;line-height:1.13;letter-spacing:-1px;margin:0 0 12px;text-align:center;font-weight:700; }
.tl-welcome-copy { font-size:16px;line-height:1.55;color:var(--tl-muted);text-align:center;margin:0 0 24px; }
.tl-auth .btn { min-height:48px;border-radius:12px;font-size:15px;white-space:normal;line-height:1.4; }
.tl-auth .btn-primary { background:var(--md-primary,#2563eb);box-shadow:none; }
.tl-auth .tl-signin { background:transparent;color:#245ac4;border:1px solid #dce3ec;margin-top:10px; }
.tl-auth .tabs { border-radius:12px;padding:4px;background:#f1f4f8; }
.tl-auth .tab { min-height:44px;border-radius:9px; }
.tl-auth .form-group label { font-size:13px;line-height:1.4; }
.tl-auth input { border-radius:12px; }
.tl-auth .footer { font-size:12px;line-height:1.7;padding-top:20px;margin-top:20px;border-top:1px solid #e7ebf2; }
.tl-language { display:flex;align-items:center;justify-content:center;gap:8px;margin:20px 0 0;font-size:13px;color:var(--tl-muted); }
.tl-language select { width:auto;max-width:180px;min-height:44px;padding:8px 28px 8px 12px;border:1px solid #dce3ec;border-radius:12px;background:#fff;color:#273850;font-size:14px; }
.tl-video { margin-top:16px;text-align:center; }
.tl-video summary { cursor:pointer;color:#536783;font-size:13px;padding:12px;min-height:44px; }
.tl-video .vid-wrap { margin:8px 0 0; }
.tl-video button.vid-wrap { display:block;width:100%;padding:0;border:0; }
.tl-public-links { max-width:440px;text-align:center;font-size:12px;line-height:2;color:#6b778b; }
.tl-public-links a { color:inherit;text-decoration:none; }
.tl-public-links a:hover { text-decoration:underline; }

/* Guided setup: clear headings, readable choice rows and one primary action. */
.tl-setup .header { margin-bottom:24px; }
.tl-setup .header-icon { display:none; }
.tl-setup .header-title { font-size:28px;letter-spacing:-.7px;line-height:1.2; }
.tl-setup .header-sub { font-size:14px;line-height:1.5; }
.tl-setup .header>.tl-rhythm { margin-bottom:16px; }
.tl-setup .card { border-radius:18px;box-shadow:none;border:1px solid var(--tl-line);padding:24px; }
.tl-setup .step-heading { font-size:24px;line-height:1.25;letter-spacing:-.5px; }
.tl-setup .step-heading>span:first-child:not([data-i18n]):not([data-quick-i18n]) { display:none; }
.tl-setup .step-sub { font-size:14px;line-height:1.6;margin-bottom:24px; }
.tl-setup :is(.act-btn,.gender-btn,.goal-btn,.identity-choice) { border-radius:12px;padding:16px;border-width:1.5px;transition:background-color var(--ui-motion-choice),border-color var(--ui-motion-choice); }
.tl-setup :is(.act-btn,.gender-btn,.goal-btn,.identity-choice).selected { box-shadow:inset 3px 0 0 var(--tl-accent); }
.tl-setup :is(.act-title,.goal-title) { font-size:15px;line-height:1.4; }
.tl-setup :is(.act-sub,.goal-sub) { font-size:13px;line-height:1.5; }
.tl-setup :is(.btn,input,select) { min-height:48px;border-radius:12px; }
.tl-setup .btn-primary { background:var(--tl-accent);box-shadow:none; }
.tl-setup .step-caption { font-size:13px;line-height:1.5;margin-bottom:20px; }
.tl-setup .step-circle { transition:background-color var(--ui-motion-choice),border-color var(--ui-motion-choice); }
.tl-setup .step-circle.active { box-shadow:0 0 0 4px var(--tl-soft); }
.tl-setup .quick-progress { border-radius:12px; }
.tl-line-icon { width:22px;height:22px;vertical-align:middle;flex-shrink:0; }
.tl-setup .act-ico { display:flex;align-items:center;justify-content:center;color:var(--tl-accent);width:32px; }
#tl-quiz .q-opt { border-radius:12px;min-height:52px;font-size:16px;transition:background-color var(--ui-motion-choice),border-color var(--ui-motion-choice); }
#tl-quiz .q-wrap h2 { font-size:28px;letter-spacing:-.6px;line-height:1.2; }
#tl-quiz .q-why { font-size:15px;line-height:1.6; }
#tl-quiz .q-bar { height:4px; }
#tl-quiz .q-top>.tl-rhythm { margin:auto; }
#tl-guest-welcome .tl-gw-card { border-radius:24px 24px 0 0;box-shadow:none; }
#tl-guest-welcome .tl-gw-icon { display:flex;justify-content:center; }

/* Everyday surfaces share the existing 12 / 18 / 24px radius family. */
html.tl-refined .screen-title { font-size:23px;line-height:1.25;letter-spacing:-.5px; }
html.tl-refined .screen-sub { font-size:13px;line-height:1.5; }
html.tl-refined :is(.card,.trial-card,.daily-momentum-card,.dash-mini-card,.tracker-card) { border-radius:18px;box-shadow:none; }
html.tl-refined :is(.btn-primary,.daily-momentum-primary) { background:var(--tl-accent);box-shadow:none; }
html.tl-refined :is(.btn,.tl-tools-primary) { border-radius:12px; }
/* Keep the welcome banner's text and controls readable on its blue gradient. */
html.tl-refined .home-hero { background:linear-gradient(145deg,#173b84 0%,#1d4ed8 56%,var(--md-primary,#2563eb) 100%);color:var(--md-on-primary,#fff);border:1px solid var(--tl-line);border-radius:18px;box-shadow:none; }
html.tl-refined .home-hero:before,html.tl-refined .home-hero:after { display:none; }
html.tl-refined #sc-home .home-hero :is(.hh-name,.hh-greeting,.hh-alias-inline,.hh-greeting-sub,.hh-date,.hh-sub,.hh-date-text) { color:var(--md-on-primary,#fff);opacity:1; }
html.tl-refined #sc-home .hh-focus-btn,
html.tl-refined #sc-home .hh-avatar { color:var(--md-on-primary,#fff);background:rgba(255,255,255,.11);border-color:rgba(255,255,255,.32); }
html.tl-refined #sc-home :is(.hh-focus-btn,.hh-avatar):focus-visible { outline-color:var(--md-on-primary,#fff); }
html.tl-refined .daily-momentum-title { font-size:20px;letter-spacing:-.3px; }
html.tl-refined .daily-momentum-card { background:var(--tl-surface);border:1px solid var(--tl-line); }
html.tl-refined .daily-momentum-recommendation { font-size:14px;line-height:1.5; }
html.tl-refined .daily-momentum-primary { min-height:64px;border-radius:12px; }
html.tl-refined .daily-momentum-primary-copy strong { font-size:16px; }
html.tl-refined .daily-momentum-primary-copy small { font-size:13px;line-height:1.4; }
html.tl-refined .daily-momentum-primary :is(strong,small,.daily-momentum-primary-arrow) { color:var(--md-on-primary,#fff); }
html.tl-refined .daily-momentum-primary-icon { background:rgba(255,255,255,.16);color:var(--md-on-primary,#fff); }
html.tl-refined :is(.home-section-heading,.sec-hd) { letter-spacing:.02em; }
html.tl-refined :is(.trial-dialog,.tl-tools-dialog) { border-radius:24px;box-shadow:0 16px 64px #101e3a24; }
html.tl-refined :is(.trial-dialog,.tl-tools-dialog)::backdrop { backdrop-filter:none;-webkit-backdrop-filter:none;background:rgba(18,30,49,.48); }
html.tl-refined .tl-tools-dialog :is(input,select,textarea) { font-size:16px;border-radius:12px; }
html.tl-refined .tl-draft-save { min-height:48px;font-size:16px; }
html.tl-refined .trial-food-row { border-radius:12px;padding:16px; }
html.tl-refined .pp-summary { min-height:76px;border-radius:12px; }
html.tl-refined .pp-copy strong { font-size:15px; }
html.tl-refined .pp-description { font-size:13px;line-height:1.5; }
.tl-motion-settings { margin:16px 0;padding:20px;border:1px solid var(--tl-line);border-radius:18px;background:var(--tl-surface); }
.tl-motion-settings h2 { margin:0 0 8px;font-size:17px; }
.tl-motion-settings>p { color:var(--tl-muted);font-size:13px;line-height:1.5; }
.tl-motion-setting { display:flex;align-items:center;justify-content:space-between;gap:16px;min-height:56px;font-size:14px;border-top:1px solid var(--tl-line);padding:12px 0; }
.tl-motion-setting input { width:20px;height:20px;flex:none;accent-color:var(--tl-accent); }
.tl-motion-setting select { font-size:14px;max-width:55%;min-height:44px;background:var(--tl-surface);color:var(--tl-ink);border:1px solid var(--tl-line);padding:8px;border-radius:12px; }
.tl-save-receipt { margin:12px 0;padding:16px;border:1px solid var(--tl-line);border-radius:18px;background:var(--tl-surface);color:var(--tl-ink);overflow-wrap:anywhere; }
.tl-save-receipt-title { display:flex;align-items:center;gap:8px;font-size:15px;font-weight:600;margin:0 0 8px; }
.tl-save-receipt .tu-saved-tools { display:flex;flex-wrap:wrap;gap:8px; }
.tl-save-receipt button { min-height:44px;font-size:14px; }
.tl-save-dismiss { margin-left:auto;border:0;background:transparent;color:var(--tl-muted);width:44px;height:44px;font-size:22px; }
.tl-save-status { color:var(--tl-accent); }
.tl-refined :is(#hyd-bar,#water-ring-progress,.macro-fill,.mc-fill,.nutr-progress-fill) { transition:width var(--ui-motion-total) var(--ui-ease),stroke-dashoffset var(--ui-motion-total) var(--ui-ease); }
.tl-refined :is(#hyd-total-ml,#home-hydration-glasses,#water-current,.macro-val,.dash-mini-value) { font-variant-numeric:tabular-nums; }
.demo-ease-details { margin:16px 12px;border:1px solid var(--tl-line);border-radius:18px;overflow:hidden; }
.demo-ease-details>summary { min-height:48px;padding:16px;font-size:14px;cursor:pointer;color:var(--tl-muted); }
.demo-ease-details[open]>summary { border-bottom:1px solid var(--tl-line); }
.demo-daily-details { margin:16px 12px;border:1px solid var(--tl-line);border-radius:18px;overflow:hidden; }
.demo-daily-details>summary { min-height:48px;padding:16px;font-size:14px;cursor:pointer;color:var(--tl-muted); }
.demo-daily-details[open]>summary { border-bottom:1px solid var(--tl-line); }
html[data-tl-celebrations="false"] :is(.phase-confetti,.med-confetti-container,.med-confetti-piece,.confetti-piece,.med-player-celebrate-trophy) { display:none!important; }
html[data-tl-celebrations="false"] .med-player-celebrate,html[data-tl-celebrations="false"] .med-player-celebrate * { animation:none!important; }
html[data-tl-celebrations="false"] :is(.ach-celebrate,.med-player-celebrate-trophy,.med-player-celebrate-stat,.med-player-celebrate-stat-n) { animation:none!important; }
html[data-tl-celebrations="false"] .med-player-celebrate-stat.ignite:before { display:none; }
.tl-refined .screen.active { animation:none; }
.tl-refined :is(.daily-momentum-score,.daily-momentum-stats,.daily-momentum-bar,.daily-momentum-kicker)[hidden] { display:none!important; }
.tl-refined .med-player-orb-pulse { display:grid;place-items:center;background:transparent;box-shadow:none; }
.tl-refined .med-player-orb-pulse .tl-rhythm { color:#a5b4fc;transform:translateY(-38px); }
.tl-refined .med-orb:before,.tl-refined .med-orb-core { animation:none; }
@media(max-width:480px) {
  body.tl-auth { padding:20px 16px;justify-content:flex-start; }
  .tl-auth>.card { padding:24px 20px; }
  .tl-auth h1 { font-size:30px; }
  .tl-welcome-art { height:140px; }
  .tl-setup .card { padding:20px 16px; }
  .tl-setup .header-title { font-size:26px; }
}
/* User preference complements, and never overrides, the OS setting. */
html[data-tl-reduced-motion="true"] *,html[data-tl-reduced-motion="true"] *:before,html[data-tl-reduced-motion="true"] *:after { animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:0s!important;scroll-behavior:auto!important; }
@media(prefers-reduced-motion:reduce) {
  *,*:before,*:after { animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:0s!important;scroll-behavior:auto!important; }
}

body.tl-auth { padding-top:max(24px,var(--tl-safe-top,0px),env(safe-area-inset-top,0px));padding-bottom:max(24px,var(--tl-safe-bottom,0px),env(safe-area-inset-bottom,0px)); }

.tl-auth .back-link[hidden] { display:none; }
